Commit 7940b5e3 authored by mthiele2's avatar mthiele2

Okay - hier ist bestimmt was wichtiges dabei

parent f7f57ba8
%YAML 1.1
%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
GameObject:
m_ObjectHideFlags: 0
......@@ -12,8 +82,8 @@ GameObject:
- component: {fileID: 50191559781069916}
- component: {fileID: 212219553255752332}
- component: {fileID: 114326583413855364}
- component: {fileID: 114716552753954768}
- component: {fileID: 9019467100873254385}
- component: {fileID: 1329814112}
m_Layer: 14
m_Name: Erd-Gegner
m_TagString: Enemy
......@@ -33,6 +103,7 @@ Transform:
m_LocalScale: {x: 2.6, y: 2.6, z: 2.6}
m_Children:
- {fileID: 5151316259711694663}
- {fileID: 1377908511}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -93,7 +164,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ab90e10760739384db3d82c49c699e73, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1
......@@ -118,23 +189,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
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
CapsuleCollider2D:
m_ObjectHideFlags: 0
......@@ -151,6 +205,23 @@ CapsuleCollider2D:
m_Offset: {x: -0.020911144, y: -0.041821234}
m_Size: {x: 0.37267685, y: 0.6654282}
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
GameObject:
m_ObjectHideFlags: 0
......@@ -178,7 +249,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7480494801806484534}
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_Children: []
m_Father: {fileID: 4738352637052488}
......@@ -197,7 +268,7 @@ BoxCollider2D:
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.20990328, y: -0.030387193}
m_Offset: {x: 0.16109717, y: 0.047701836}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
......@@ -208,7 +279,7 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.4117798, y: 0.78250855}
m_Size: {x: 0.509392, y: 0.9386866}
m_EdgeRadius: 0
--- !u!114 &5069815732207941033
MonoBehaviour:
......@@ -222,7 +293,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b4c5235d64f63fa4bb18488fb942c207, type: 3}
m_Name:
m_EditorClassIdentifier:
thrust: 20
thrust: 30
enemyPosition: {fileID: 4738352637052488}
--- !u!212 &4099466460450311807
SpriteRenderer:
......
This diff is collapsed.
......@@ -7,66 +7,70 @@ public class RockAttack : WeightedAction {
AI_Core myAI;
public Collider2D Erdangriff;
public GameObject Erdangriff;
public float attackRange;
private float restCooldown;
public float attackTime;
private bool right;
private float timePassed;
public float Cooldown;
private float attackFinished;
public float attackStun;
public float speed;
public Transform target;
private Vector3 startPos;
private Vector3 endpos;
private Vector3 velocity;
public float attackRange;
// Use this for initialization
void Start ()
{
myAI = GetComponent<AI_Core>();
Erdangriff.enabled = false;
}
isPerformingAction = false;
velocity = Vector3.zero;
}
void CheckConditions() {
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (!isPerformingAction)
{
if (myAI.rangeCheckFailed(transform, attackRange))
{
return;
}
timePassed = Time.time;
attackFinished = timePassed + attackTime;
if (dist > attackRange)
{
return;
}
startPos = Erdangriff.transform.position;
endpos = target.position;
weight = 10f;
isPerformingAction = true;
}
myAI.desiredAction.Add(this);
}
public override void performAction()
{
if (restCooldown <= 0)
{
StartCoroutine(Attack(right));
restCooldown = Cooldown;
}
else
{
restCooldown -= Time.deltaTime;
}
}
IEnumerator Attack(bool right)
{
Erdangriff.enabled = true;
yield return new WaitForSeconds(Cooldown);
Erdangriff.enabled = false;
if(timePassed > attackFinished)
{
isPerformingAction = false;
}
else if (timePassed > attackFinished - attackTime/2)
{
Erdangriff.transform.position = Vector3.MoveTowards(Erdangriff.transform.position, startPos, Time.deltaTime * speed);
}
else
{
Erdangriff.transform.position = Vector3.MoveTowards(Erdangriff.transform.position, endpos, Time.deltaTime * speed);
}
timePassed += Time.deltaTime;
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
}
}
......@@ -9,12 +9,12 @@ public class rockCollider : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player")){
Vector2 dir = other.GetComponentInParent<Transform>().position - enemyPosition.position;
if (other.CompareTag("Player"))
{
Vector2 dir = new Vector2(other.GetComponentInParent<Transform>().position.x - enemyPosition.position.x, 0);
dir.Normalize();
dir *= thrust;
other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse);
//other.attachedRigidbody.AddForce(Vector2.right*thrust, ForceMode2D.Impulse);
}
}
}
......@@ -60,13 +60,13 @@ public class AI_Core : MonoBehaviour {
public bool rangeCheckFailed(Transform pos, float range)
{
GameObject nearestPlayer = findNearestPlayer();
GameObject player = GameObject.FindGameObjectWithTag("Player");
if (nearestPlayer == null)
if (player == null)
{
return true;
}
else if(Vector2.Distance(pos.position, nearestPlayer.transform.position) > range)
else if(Vector2.Distance(pos.position, player.transform.position) > range)
{
return true;
}
......
......@@ -6,6 +6,10 @@ public class isHittingWall : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.layer != LayerMask.NameToLayer("Ground"))
{
return;
}
this.GetComponentInParent<AI_WaterAttack>().turn();
}
}
......@@ -28,7 +28,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
private void Update()
{
_ready = Time.time > _nextFire;
_ready = Time.time > _nextFire && !controller.Grounded;
}
public bool Attack()
......@@ -55,18 +55,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
isStomping = false;
controller.GetComponentInParent<Rigidbody2D>().gravityScale /= massIncrease;
//var c = Physics2D.CircleCast(transform.position, 0.25f, Vector2.down, contactFilter2D, RaycastHits2D, 0.6f);
//for (var i = 0; i < c; i++)
//{
// if (RaycastHits2D[i].transform.gameObject == gameObject) continue;
// if (RaycastHits2D[i].transform.gameObject.CompareTag("DestroyableByEarth"))
// {
// Destroy(RaycastHits2D[i].transform.gameObject);
// }
//}
}
}
}
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