Commit 333dc944 authored by Isa's avatar Isa

Versuch 2

parents f2576c7d f7f57ba8
......@@ -13,8 +13,8 @@ GameObject:
- component: {fileID: 70840632841850180}
- component: {fileID: 212152556601460820}
- component: {fileID: 5567333940966867164}
m_Layer: 0
m_Name: Pre_PlayerFireAttack
m_Layer: 12
m_Name: FireAttack
m_TagString: Fire
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......
......@@ -142,3 +142,4 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
destroyTime: 3
pushFactor: 5
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6184296985288555399
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8257885254229348828}
- component: {fileID: 3590286897431027205}
- component: {fileID: 4292658995770755931}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8257885254229348828
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6184296985288555399}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7732554449417407852}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &3590286897431027205
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6184296985288555399}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!114 &4292658995770755931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6184296985288555399}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5c135c3fe901cf4696abeebd2ac1f28, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &6240296448730384320
GameObject:
m_ObjectHideFlags: 0
......@@ -10,9 +80,8 @@ GameObject:
m_Component:
- component: {fileID: 7732554449417407852}
- component: {fileID: 1297297354442121813}
- component: {fileID: 2063039573222851098}
- component: {fileID: 5308590249232017486}
- component: {fileID: 4079281900754592225}
- component: {fileID: 7986769661104333248}
- component: {fileID: 762648849805719858}
m_Layer: 9
m_Name: Movable_Thing
m_TagString: Untagged
......@@ -30,7 +99,8 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 133.12, y: 41.63, z: -0.017713891}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 8257885254229348828}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -82,21 +152,29 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &2063039573222851098
MonoBehaviour:
--- !u!50 &7986769661104333248
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6240296448730384320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5c135c3fe901cf4696abeebd2ac1f28, type: 3}
m_Name:
m_EditorClassIdentifier:
force: 0
--- !u!60 &5308590249232017486
PolygonCollider2D:
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &762648849805719858
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
......@@ -112,143 +190,12 @@ PolygonCollider2D:
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 8, y: 8}
oldSize: {x: 2, y: 2}
newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: 1.3359375, y: -2.109375}
- {x: 1.4140625, y: -2.09375}
- {x: 1.5234375, y: -2.0703125}
- {x: 1.546875, y: -2.0625}
- {x: 1.7265625, y: -2}
- {x: 1.84375, y: -1.984375}
- {x: 1.9609375, y: -1.9609375}
- {x: 2.1171875, y: -1.8671875}
- {x: 2.2578125, y: -1.7421875}
- {x: 2.3828125, y: -1.625}
- {x: 2.40625, y: -1.5859375}
- {x: 2.4140625, y: -1.546875}
- {x: 2.4140625, y: -1.40625}
- {x: 2.3828125, y: -1.203125}
- {x: 2.328125, y: -1}
- {x: 2.25, y: -0.6328125}
- {x: 2.1484375, y: -0.125}
- {x: 2.109375, y: 0.0078125}
- {x: 2.0625, y: 0.1328125}
- {x: 2.0234375, y: 0.1875}
- {x: 1.96875, y: 0.25}
- {x: 1.9375, y: 0.3359375}
- {x: 1.859375, y: 0.5}
- {x: 1.8203125, y: 0.5546875}
- {x: 1.765625, y: 0.6328125}
- {x: 1.6953125, y: 0.7265625}
- {x: 1.65625, y: 0.8125}
- {x: 1.609375, y: 0.9609375}
- {x: 1.5859375, y: 1}
- {x: 1.5390625, y: 1.0546875}
- {x: 1.46875, y: 1.09375}
- {x: 1.390625, y: 1.1015625}
- {x: 1.2265625, y: 1.1015625}
- {x: 1.203125, y: 1.125}
- {x: 1.09375, y: 1.109375}
- {x: 1.0390625, y: 1.0625}
- {x: 0.828125, y: 0.859375}
- {x: 0.609375, y: 0.6875}
- {x: 0.5234375, y: 0.6484375}
- {x: 0.46875, y: 0.640625}
- {x: 0.3828125, y: 0.734375}
- {x: 0.25, y: 0.9921875}
- {x: 0.1328125, y: 1.1875}
- {x: -0.0390625, y: 1.515625}
- {x: -0.1015625, y: 1.6015625}
- {x: -0.171875, y: 1.6875}
- {x: -0.21875, y: 1.78125}
- {x: -0.25, y: 1.890625}
- {x: -0.265625, y: 2}
- {x: -0.296875, y: 2.1015625}
- {x: -0.328125, y: 2.1484375}
- {x: -0.4453125, y: 2.265625}
- {x: -0.4609375, y: 2.296875}
- {x: -0.53125, y: 2.359375}
- {x: -0.6015625, y: 2.359375}
- {x: -0.65625, y: 2.3359375}
- {x: -0.7421875, y: 2.3125}
- {x: -0.8359375, y: 2.21875}
- {x: -0.9765625, y: 2.0390625}
- {x: -1.0703125, y: 1.8984375}
- {x: -1.171875, y: 1.71875}
- {x: -1.2265625, y: 1.6015625}
- {x: -1.3203125, y: 1.3984375}
- {x: -1.4453125, y: 1.109375}
- {x: -1.4921875, y: 1.015625}
- {x: -1.59375, y: 0.765625}
- {x: -1.7578125, y: 0.3359375}
- {x: -1.8203125, y: 0.1953125}
- {x: -1.9140625, y: 0.0234375}
- {x: -1.9765625, y: -0.0390625}
- {x: -2.046875, y: -0.0703125}
- {x: -2.09375, y: -0.1171875}
- {x: -2.1953125, y: -0.234375}
- {x: -2.25, y: -0.21875}
- {x: -2.3515625, y: -0.2421875}
- {x: -2.390625, y: -0.2890625}
- {x: -2.4375, y: -0.390625}
- {x: -2.4765625, y: -0.6796875}
- {x: -2.4921875, y: -0.8203125}
- {x: -2.5078125, y: -1}
- {x: -2.5390625, y: -1.3125}
- {x: -2.546875, y: -1.421875}
- {x: -2.546875, y: -1.640625}
- {x: -2.53125, y: -1.6796875}
- {x: -2.4609375, y: -1.75}
- {x: -2.3984375, y: -1.796875}
- {x: -2.109375, y: -1.9375}
- {x: -1.9921875, y: -1.984375}
- {x: -1.8671875, y: -2.03125}
- {x: -1.65625, y: -2.078125}
- {x: -1.53125, y: -2.1171875}
- {x: -1.4609375, y: -2.125}
- {x: -1.40625, y: -2.1328125}
- {x: -1.140625, y: -2.1328125}
- {x: -0.953125, y: -2.1171875}
- {x: -0.6875, y: -2.109375}
- {x: -0.5859375, y: -2.1015625}
- {x: -0.4375, y: -2.1015625}
- {x: -0.21875, y: -2.140625}
- {x: -0.0859375, y: -2.1484375}
- {x: 0.0078125, y: -2.125}
- {x: 0.1015625, y: -2.0625}
- {x: 0.203125, y: -2.0703125}
- {x: 0.3359375, y: -2.1015625}
- {x: 0.4609375, y: -2.1640625}
- {x: 0.5078125, y: -2.1796875}
- {x: 0.5625, y: -2.1953125}
- {x: 0.6875, y: -2.1953125}
- {x: 0.796875, y: -2.1796875}
- {x: 1.0234375, y: -2.1328125}
- {x: 1.1328125, y: -2.1171875}
--- !u!50 &4079281900754592225
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6240296448730384320}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
serializedVersion: 2
m_Size: {x: 2, y: 2}
m_EdgeRadius: 0
......@@ -258,7 +258,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
cooldown: 1
massIncrease: 30
massIncrease: 5
isStomping: 0
--- !u!114 &352228605
MonoBehaviour:
......
......@@ -778,7 +778,7 @@ BoxCollider2D:
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 2, y: 2}
oldSize: {x: 8, y: 8}
newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5
drawMode: 0
......@@ -10561,7 +10561,7 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 1738372363}
m_PrefabAsset: {fileID: 0}
--- !u!114 &847607783
--- !u!114 &847607772
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
......@@ -23755,7 +23755,7 @@ BoxCollider2D:
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 2, y: 2}
oldSize: {x: 8, y: 8}
newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5
drawMode: 0
......
......@@ -55,7 +55,7 @@ public class AI_WindAttack : WeightedAction
public void Fire(Vector3 attackdir)
{
GameObject projectile = Instantiate(windAttack, transform.position + attackdir*2, Quaternion.AngleAxis(Mathf.Atan2(-attackdir.y, -attackdir.x) * Mathf.Rad2Deg + 180, Vector3.forward));
GameObject projectile = Instantiate(windAttack, transform.position + attackdir*2, Quaternion.AngleAxis(0, Vector3.forward));
projectile.GetComponent<AI_WindProjectile>().setValues(damage, destroyTime, thrust);
body = projectile.GetComponent<Rigidbody2D>();
......
......@@ -14,6 +14,10 @@ public class AI_WindProjectile : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("EnemyShot"))
{
return;
}
if (other.CompareTag("Player"))
{
Vector2 dir = other.GetComponentInParent<Transform>().position - transform.position;
......
......@@ -12,7 +12,7 @@ public class AI_FireProjectile : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Fire"))
if (other.CompareTag("Fire") || other.CompareTag("EnemyShot"))
{
return;
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SliderObject : MonoBehaviour
namespace _Game.Scripts.Level_Hazards
{
private Rigidbody2D rb;
public float force;
/*private void OnTriggerEnter2D(Collider2D collision)
{
if (!GetComponent<Rigidbody2D>())
{
rb = GetComponent<Rigidbody2D>();
}
else
{
Debug.Log("Kein Rigidbody");
}
if (collision.gameObject.CompareTag("Water"))
{
if(collision.transform.position.x > GetComponent<Transform>().position.x)
public class SliderObject : MonoBehaviour
{
rb.AddForce(new Vector2(-force, 0));
}else if (collision.transform.position.x < GetComponent<Transform>().position.x)
private Vector2 _position;
private Rigidbody2D _rigidbody2D;
private void Start()
{
rb.AddForce(new Vector2(force, 0));
_rigidbody2D = this.GetComponentInParent<Rigidbody2D>();
}
}
}*/
private void OnCollisionEnter2D(Collision2D other)
{
if (other.transform.gameObject.tag.Equals("Water"))
if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("Enemy") ||
other.gameObject.CompareTag("Fire"))
{
gameObject.GetComponent<Rigidbody2D>().velocity = other.gameObject.GetComponent<Rigidbody2D>().velocity;
_rigidbody2D.velocity = Vector2.zero;
_rigidbody2D.bodyType = RigidbodyType2D.Static;
}
}
private void OnCollisionExit2D(Collision2D other)
{
if (other.transform.gameObject.tag.Equals("Water"))
if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("Enemy") ||
other.gameObject.CompareTag("Fire"))
{
gameObject.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
_rigidbody2D.velocity = Vector2.zero;
_rigidbody2D.bodyType = RigidbodyType2D.Dynamic;
}
}
}
}
......@@ -34,9 +34,13 @@ public class Life : MonoBehaviour {
}
public void Death(){
//Reset
if (gameObject.CompareTag("Player"))
{
gameObject.SetActive(false);
Debug.Log("Death");
return;
}
Destroy(gameObject);
}
public int getCurrentLife()
......
......@@ -5,6 +5,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
public class PlayerWaterProjectile : MonoBehaviour
{
public float destroyTime = 2.0f;
public float pushFactor = 1.0f;
private float _startTime;
private float _deltaTime;
private float _newScaleFactor;
......@@ -18,7 +19,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
_startTime = Time.time;
_startingScale = this.gameObject.transform.localScale;
_rigidbody2D = GetComponent<Rigidbody2D>();
_startingVelocity = _rigidbody2D.velocity;
}
private void Update()
......@@ -38,6 +38,24 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
this.gameObject.transform.localScale = _newScaleVector;
}
public void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.layer != LayerMask.NameToLayer("Ground"))
{
if (other.gameObject.layer == LayerMask.NameToLayer("MovableObject"))
{
if (Mathf.Abs(_rigidbody2D.velocity.x) > 0.0001f)
{
var projectileVelocityX = _rigidbody2D.velocity.x / Mathf.Abs(_rigidbody2D.velocity.x);
print(projectileVelocityX);
other.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector3(projectileVelocityX * pushFactor, 0.0f, 0.0f);
}
}
Destroy();
}
}
private void OnEnable()
{
Invoke(nameof(Destroy), destroyTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment