Commit d52dd30e authored by Sebastian Frey's avatar Sebastian Frey
Browse files

Merge remote-tracking branch 'origin/master'

parents 03bcfdf7 19ca8ff1
...@@ -142,5 +142,5 @@ MonoBehaviour: ...@@ -142,5 +142,5 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
destroyTime: 3 destroyTime: 3
pushFactor: 5 pushFactor: 6
pushEnemyFactor: 1000 pushEnemyFactor: 1000
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &1377908510
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1377908511}
- component: {fileID: 1377908513}
- component: {fileID: 1377908512}
m_Layer: 14
m_Name: GroundCheck
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1377908511
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377908510}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.444, y: -0.025, z: 0}
m_LocalScale: {x: 0.3846154, y: 0.3846154, z: 0.3846154}
m_Children: []
m_Father: {fileID: 4738352637052488}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1377908513
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377908510}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
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: 0.1, y: 0.1}
m_EdgeRadius: 0
--- !u!114 &1377908512
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377908510}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a5f53fd08a8579644bb23274b07d6f11, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1634356314439590 --- !u!1 &1634356314439590
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -12,8 +82,8 @@ GameObject: ...@@ -12,8 +82,8 @@ GameObject:
- component: {fileID: 50191559781069916} - component: {fileID: 50191559781069916}
- component: {fileID: 212219553255752332} - component: {fileID: 212219553255752332}
- component: {fileID: 114326583413855364} - component: {fileID: 114326583413855364}
- component: {fileID: 114716552753954768}
- component: {fileID: 9019467100873254385} - component: {fileID: 9019467100873254385}
- component: {fileID: 1329814112}
m_Layer: 14 m_Layer: 14
m_Name: Erd-Gegner m_Name: Erd-Gegner
m_TagString: Enemy m_TagString: Enemy
...@@ -33,6 +103,7 @@ Transform: ...@@ -33,6 +103,7 @@ Transform:
m_LocalScale: {x: 2.6, y: 2.6, z: 2.6} m_LocalScale: {x: 2.6, y: 2.6, z: 2.6}
m_Children: m_Children:
- {fileID: 5151316259711694663} - {fileID: 5151316259711694663}
- {fileID: 1377908511}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -93,7 +164,7 @@ SpriteRenderer: ...@@ -93,7 +164,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1206248169 m_SortingLayerID: 1206248169
m_SortingLayer: 3 m_SortingLayer: 3
m_SortingOrder: 1 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ab90e10760739384db3d82c49c699e73, type: 3} m_Sprite: {fileID: 21300000, guid: ab90e10760739384db3d82c49c699e73, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1 m_FlipX: 1
...@@ -118,23 +189,6 @@ MonoBehaviour: ...@@ -118,23 +189,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
desiredAction: [] desiredAction: []
--- !u!114 &114716552753954768
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634356314439590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 57d175ecd2f7e53468c6c7467bdb8980, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 1
isPerformingAction: 0
movementSpeed: 5
aggroRange: 6
dropAggroRange: 7
--- !u!70 &9019467100873254385 --- !u!70 &9019467100873254385
CapsuleCollider2D: CapsuleCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -151,6 +205,23 @@ CapsuleCollider2D: ...@@ -151,6 +205,23 @@ CapsuleCollider2D:
m_Offset: {x: -0.020911144, y: -0.041821234} m_Offset: {x: -0.020911144, y: -0.041821234}
m_Size: {x: 0.37267685, y: 0.6654282} m_Size: {x: 0.37267685, y: 0.6654282}
m_Direction: 0 m_Direction: 0
--- !u!114 &1329814112
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634356314439590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 92a90f5cf106fa548bfb90c03a6aa928, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 2
isPerformingAction: 0
speed: 5
distance: 2
groundDetection: {fileID: 1377908511}
--- !u!1 &7480494801806484534 --- !u!1 &7480494801806484534
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -178,7 +249,7 @@ Transform: ...@@ -178,7 +249,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7480494801806484534} m_GameObject: {fileID: 7480494801806484534}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.106, y: -0.061, z: 0} m_LocalPosition: {x: 0.072, y: -0.054, z: 0}
m_LocalScale: {x: 0.7, y: 0.7, z: 0.3846154} m_LocalScale: {x: 0.7, y: 0.7, z: 0.3846154}
m_Children: [] m_Children: []
m_Father: {fileID: 4738352637052488} m_Father: {fileID: 4738352637052488}
...@@ -197,7 +268,7 @@ BoxCollider2D: ...@@ -197,7 +268,7 @@ BoxCollider2D:
m_IsTrigger: 1 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0.20990328, y: -0.030387193} m_Offset: {x: 0.16109717, y: 0.047701836}
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
...@@ -208,7 +279,7 @@ BoxCollider2D: ...@@ -208,7 +279,7 @@ BoxCollider2D:
adaptiveTiling: 0 adaptiveTiling: 0
m_AutoTiling: 0 m_AutoTiling: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.4117798, y: 0.78250855} m_Size: {x: 0.509392, y: 0.9386866}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &5069815732207941033 --- !u!114 &5069815732207941033
MonoBehaviour: MonoBehaviour:
...@@ -222,7 +293,7 @@ MonoBehaviour: ...@@ -222,7 +293,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b4c5235d64f63fa4bb18488fb942c207, type: 3} m_Script: {fileID: 11500000, guid: b4c5235d64f63fa4bb18488fb942c207, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
thrust: 20 thrust: 30
enemyPosition: {fileID: 4738352637052488} enemyPosition: {fileID: 4738352637052488}
--- !u!212 &4099466460450311807 --- !u!212 &4099466460450311807
SpriteRenderer: SpriteRenderer:
......
...@@ -82,6 +82,7 @@ GameObject: ...@@ -82,6 +82,7 @@ GameObject:
- component: {fileID: 1297297354442121813} - component: {fileID: 1297297354442121813}
- component: {fileID: 7986769661104333248} - component: {fileID: 7986769661104333248}
- component: {fileID: 762648849805719858} - component: {fileID: 762648849805719858}
- component: {fileID: 3245477875503789237}
m_Layer: 9 m_Layer: 9
m_Name: Movable_Thing m_Name: Movable_Thing
m_TagString: Untagged m_TagString: Untagged
...@@ -180,7 +181,7 @@ BoxCollider2D: ...@@ -180,7 +181,7 @@ BoxCollider2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6240296448730384320} m_GameObject: {fileID: 6240296448730384320}
m_Enabled: 1 m_Enabled: 0
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
...@@ -190,7 +191,7 @@ BoxCollider2D: ...@@ -190,7 +191,7 @@ BoxCollider2D:
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 2, y: 2} oldSize: {x: 8, y: 8}
newSize: {x: 2, y: 2} newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
...@@ -199,3 +200,27 @@ BoxCollider2D: ...@@ -199,3 +200,27 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 2, y: 2} m_Size: {x: 2, y: 2}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!68 &3245477875503789237
EdgeCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6240296448730384320}
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_EdgeRadius: 0
m_Points:
- {x: 1.376297, y: 1.02034}
- {x: 2.392273, y: -1.5522537}
- {x: 1.1309052, y: -2.1011238}
- {x: -1.2424622, y: -2.0922089}
- {x: -2.548645, y: -1.7105446}
- {x: -0.55908203, y: 2.3164673}
- {x: 0.5983124, y: 0.56339645}
- {x: 1.3628845, y: 1.0883636}
This diff is collapsed.
This diff is collapsed.
...@@ -7,17 +7,25 @@ public class RockAttack : WeightedAction { ...@@ -7,17 +7,25 @@ public class RockAttack : WeightedAction {
AI_Core myAI; AI_Core myAI;
public Collider2D Erdangriff; public GameObject Erdangriff;
private float restCooldown; public float attackRange;
private bool right; public float attackTime;
public float Cooldown; private float timePassed;
public float attackStun; private float attackFinished;
public float attackRange; public float speed;
public Transform target;
private Vector3 startPos;
private Vector3 endpos;
private Vector3 velocity;
// Use this for initialization // Use this for initialization
...@@ -25,48 +33,44 @@ public class RockAttack : WeightedAction { ...@@ -25,48 +33,44 @@ public class RockAttack : WeightedAction {
{ {
myAI = GetComponent<AI_Core>(); myAI = GetComponent<AI_Core>();
Erdangriff.enabled = false; isPerformingAction = false;
velocity = Vector3.zero;
} }
void CheckConditions() { void CheckConditions() {
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (!isPerformingAction)
if (dist > attackRange) {
if (myAI.rangeCheckFailed(transform, attackRange))
{ {
return; return;
} }
timePassed = Time.time;
attackFinished = timePassed + attackTime;
weight = 10f; startPos = Erdangriff.transform.position;
endpos = target.position;
isPerformingAction = true;
}
myAI.desiredAction.Add(this); myAI.desiredAction.Add(this);
} }
public override void performAction() public override void performAction()
{ {
if (restCooldown <= 0) if(timePassed > attackFinished)
{ {
StartCoroutine(Attack(right)); isPerformingAction = false;
restCooldown = Cooldown;
} }
else else if (timePassed > attackFinished - attackTime/2)
{ {
restCooldown -= Time.deltaTime; Erdangriff.transform.position = Vector3.MoveTowards(Erdangriff.transform.position, startPos, Time.deltaTime * speed);
}
} }
else
IEnumerator Attack(bool right)
{ {
Erdangriff.enabled = true; Erdangriff.transform.position = Vector3.MoveTowards(Erdangriff.transform.position, endpos, Time.deltaTime * speed);
yield return new WaitForSeconds(Cooldown);
Erdangriff.enabled = false;
} }
timePassed += Time.deltaTime;
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
} }
} }
...@@ -9,12 +9,12 @@ public class rockCollider : MonoBehaviour ...@@ -9,12 +9,12 @@ public class rockCollider : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other) private void OnTriggerEnter2D(Collider2D other)
{ {
if (other.CompareTag("Player")){ if (other.CompareTag("Player"))
Vector2 dir = other.GetComponentInParent<Transform>().position - enemyPosition.position; {
Vector2 dir = new Vector2(other.GetComponentInParent<Transform>().position.x - enemyPosition.position.x, 0);
dir.Normalize(); dir.Normalize();
dir *= thrust; dir *= thrust;
other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse); other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse);
//other.attachedRigidbody.AddForce(Vector2.right*thrust, ForceMode2D.Impulse);
} }
} }
} }
...@@ -60,13 +60,13 @@ public class AI_Core : MonoBehaviour { ...@@ -60,13 +60,13 @@ public class AI_Core : MonoBehaviour {
public bool rangeCheckFailed(Transform pos, float range) public bool rangeCheckFailed(Transform pos, float range)
{ {
GameObject nearestPlayer = findNearestPlayer(); GameObject player = GameObject.FindGameObjectWithTag("Player");
if (nearestPlayer == null) if (player == null)
{ {
return true; return true;
} }
else if(Vector2.Distance(pos.position, nearestPlayer.transform.position) > range) else if(Vector2.Distance(pos.position, player.transform.position) > range)
{ {
return true; return true;
} }
......
...@@ -6,6 +6,10 @@ public class isHittingWall : MonoBehaviour ...@@ -6,6 +6,10 @@ public class isHittingWall : MonoBehaviour
{ {
private void OnTriggerEnter2D(Collider2D collision) private void OnTriggerEnter2D(Collider2D collision)
{ {
if (collision.gameObject.layer != LayerMask.NameToLayer("Ground"))
{
return;
}
this.GetComponentInParent<AI_WaterAttack>().turn(); this.GetComponentInParent<AI_WaterAttack>().turn();
} }
} }
...@@ -4,6 +4,7 @@ using System.Collections.Generic; ...@@ -4,6 +4,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using _Game.Scripts.Scriptable_Object; using _Game.Scripts.Scriptable_Object;
using _Game.Scripts.Player.PlayerAttacks.Earth;
[RequireComponent(typeof(Rigidbody2D), typeof(CapsuleCollider2D))] [RequireComponent(typeof(Rigidbody2D), typeof(CapsuleCollider2D))]
public class MovementController : MonoBehaviour public class MovementController : MonoBehaviour
...@@ -169,6 +170,12 @@ public class MovementController : MonoBehaviour ...@@ -169,6 +170,12 @@ public class MovementController : MonoBehaviour
} }
public void UpdateMovementParameters() public void UpdateMovementParameters()
{
if (GetComponentInParent<PlayerEarthAttack>().isStomping)
{
Invoke("UpdateMovementParameters", 0.01f);
}
else
{ {
MovementState state = r_State.GetCurrentMovementState(); MovementState state = r_State.GetCurrentMovementState();
m_JumpForce = state.jumpForce; m_JumpForce = state.jumpForce;
...@@ -180,6 +187,7 @@ public class MovementController : MonoBehaviour ...@@ -180,6 +187,7 @@ public class MovementController : MonoBehaviour
m_Rigidbody2D.mass = state.mass; m_Rigidbody2D.mass = state.mass;
m_Rigidbody2D.gravityScale = state.gravity; m_Rigidbody2D.gravityScale = state.gravity;
} }
}
public void SetSwimming(bool value) public void SetSwimming(bool value)
{ {
......
...@@ -10,9 +10,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth ...@@ -10,9 +10,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
public float massIncrease; public float massIncrease;
public bool isStomping; public bool isStomping;
MovementController controller; MovementController controller;
private RaycastHit2D[] RaycastHits2D = new RaycastHit2D[8];
private LayerMask whatIsDestroyable;
private ContactFilter2D contactFilter2D;
private bool _ready; private bool _ready;
private bool _activated; private bool _activated;
...@@ -20,7 +17,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth ...@@ -20,7 +17,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
void Start() void Start()
{ {
controller = GetComponentInParent<MovementController>(); controller = GetComponentInParent<MovementController>();
contactFilter2D.SetLayerMask(whatIsDestroyable);
_nextFire = 0; _nextFire = 0;
_ready = true; _ready = true;
...@@ -28,7 +24,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth ...@@ -28,7 +24,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
private void Update() private void Update()
{ {
_ready = Time.time > _nextFire; _ready = Time.time > _nextFire && !controller.Grounded;
} }
public bool Attack() public bool Attack()
...@@ -55,18 +51,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth ...@@ -55,18 +51,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth