Commit 83cc7a2f authored by mthiele2's avatar mthiele2
Browse files

AI Erdgegner prototyp

parent 0e742874
fileFormatVersion: 2
guid: 83b2ccd8caab22846876189bc6815151
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: af7181f404f1447c0a7a17b3070b952b, type: 3}
m_Name: GroundSpriteProfile
m_Name: GroundLineProfile
m_EditorClassIdentifier:
m_Angles:
- m_Start: -180
......
......@@ -14,7 +14,6 @@ GameObject:
- component: {fileID: 212219553255752332}
- component: {fileID: 114326583413855364}
- component: {fileID: 114716552753954768}
- component: {fileID: 2443674996375463819}
m_Layer: 0
m_Name: Erd-Gegner
m_TagString: Enemy
......@@ -118,7 +117,7 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 275444261
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 54925aea4bcc94726afa87df59ae72f7, type: 3}
......@@ -164,24 +163,6 @@ MonoBehaviour:
weight: 0
isPerformingAction: 0
movementSpeed: 5
--- !u!114 &2443674996375463819
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: 7b1704336be649844bc32289444199c2, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 0
isPerformingAction: 0
Erdangriff: {fileID: 7574451920411087056}
Cooldown: 2
attackStun: 1
attackRange: 3
--- !u!1 &7480494801806484534
GameObject:
m_ObjectHideFlags: 0
......@@ -191,7 +172,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 5151316259711694663}
- component: {fileID: 1665095659038006098}
- component: {fileID: 7574451920411087056}
- component: {fileID: 5069815732207941033}
m_Layer: 0
......@@ -215,27 +195,6 @@ Transform:
m_Father: {fileID: 4738352637052488}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &1665095659038006098
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7480494801806484534}
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 &7574451920411087056
BoxCollider2D:
m_ObjectHideFlags: 0
......@@ -249,7 +208,7 @@ BoxCollider2D:
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.39001465, y: -0.033706665}
m_Offset: {x: -0.29129028, y: -0.033706665}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
......@@ -260,7 +219,7 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.28735352, y: 0.8555298}
m_Size: {x: 0.48480225, y: 0.8555298}
m_EdgeRadius: 0
--- !u!114 &5069815732207941033
MonoBehaviour:
......@@ -275,3 +234,4 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
thrust: 20
enemyPosition: {fileID: 4738352637052488}
......@@ -117,7 +117,7 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 275444261
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: baa0c643131554ff99574059ec7da1cc, type: 3}
......
......@@ -105,7 +105,7 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 275444261
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
......@@ -132,6 +132,5 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
damage: 0
fireSpeed: 0
nearestPlayer: {fileID: 0}
destroyTime: 1
......@@ -118,7 +118,7 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 275444261
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 86ca59b9bca0e409b9ba2784fbe69f01, type: 3}
......
......@@ -15,9 +15,8 @@ GameObject:
- component: {fileID: 114326583413855364}
- component: {fileID: 114716552753954768}
- component: {fileID: 114692363085912100}
- component: {fileID: 114311635033982838}
m_Layer: 0
m_Name: Vogel-Gegner
m_Name: Wind-Gegner
m_TagString: Enemy
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -118,7 +117,7 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 275444261
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: f240dfd4814d34d55a9b033f3c9d8a60, type: 3}
......@@ -163,7 +162,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
weight: 0
isPerformingAction: 0
movementSpeed: 8
movementSpeed: 6
--- !u!114 &114692363085912100
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -180,25 +179,3 @@ MonoBehaviour:
isPerformingAction: 0
startWaitTime: 1
patrolRange: 4
--- !u!114 &114311635033982838
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: 7f52887a9ca8e98419e0fa123a56c1f0, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 10
isPerformingAction: 0
Cooldown: 1
attackRange: 15
damage: 1
shot: {fileID: 1870586037468468, guid: 61411254df3161c4e81f6c0a4f2cd33c, type: 3}
fireSpeed: 15
pooledAmount: 10
cluster: 0
ricochet: 0
......@@ -103,8 +103,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 72de0c64f2c6a498096698322c976a67, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......
......@@ -62,7 +62,6 @@ public class AI_FireAttack : WeightedAction
public override void performAction()
{
rotateToPlayer();
if (restCooldown <= 0)
{
if (isPerformingAction)
......@@ -80,17 +79,6 @@ public class AI_FireAttack : WeightedAction
}
}
private void rotateToPlayer(){
if(nearestPlayer.transform.position.x > this.transform.position.x)
{
transform.eulerAngles = new Vector3(0, 0, 0);
}
else
{
transform.eulerAngles = new Vector3(0, -180, 0);
}
}
IEnumerator fireVolley()
{
launchPower = 10;
......
......@@ -48,7 +48,15 @@ public class AI_Core : MonoBehaviour {
public GameObject findNearestPlayer()
{
GameObject player = GameObject.FindGameObjectWithTag("Player");
return player;
GameObject player = GameObject.FindGameObjectWithTag("Player");
if (player.transform.position.x > this.transform.position.x)
{
transform.eulerAngles = new Vector3(0, 0, 0);
}
else
{
transform.eulerAngles = new Vector3(0, -180, 0);
}
return player;
}
}
using UnityEngine;
using UnityEngine;
using System.Collections;
public class AI_Follows : WeightedAction
......@@ -8,7 +8,7 @@ public class AI_Follows : WeightedAction
AI_Core myAI;
public float movementSpeed=5;
public float movementSpeed;
private Animator animator;
......@@ -57,23 +57,6 @@ public class AI_Follows : WeightedAction
public override void performAction()
{
Vector3 newPosition = direction * movementSpeed * Time.deltaTime;
transform.position += newPosition;
AnimateEnemy();
}
void AnimateEnemy()
{
if (gameObject.GetComponent<Animator>() != null)
{
if (direction.sqrMagnitude > 0f)
{
animator.SetBool("IsMoving", true);
}
animator.SetFloat("XSpeed", direction.x);
animator.SetFloat("YSpeed", direction.y);
}
transform.position = Vector2.MoveTowards(transform.position, nearestPlayer.transform.position, movementSpeed * Time.deltaTime);
}
}
......@@ -52,14 +52,6 @@ public class RockAttack : WeightedAction {
{
if (restCooldown <= 0)
{
if (nearestPlayer.transform.position.x > this.transform.position.x)
{
right = true;
}
else
{
right = false;
}
StartCoroutine(Attack(right));
restCooldown = Cooldown;
......@@ -72,16 +64,8 @@ public class RockAttack : WeightedAction {
IEnumerator Attack(bool right)
{
if (right)
{
transform.eulerAngles = new Vector3(0, 0, 0);
}
else
{
transform.eulerAngles = new Vector3(0, -180, 0);
}
Erdangriff.enabled = true;
yield return new WaitForSeconds(attackStun);
yield return new WaitForSeconds(Cooldown);
Erdangriff.enabled = false;
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rockCollider : MonoBehaviour
{
public float thrust;
public Transform enemyPosition;
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player")){
//Vector2 dir = other.GetComponentInParent<Transform>().position - enemyPosition.position;
//dir.Normalize();
//dir *= thrust;
//other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse);
other.attachedRigidbody.AddForce(Vector2.right*thrust, ForceMode2D.Impulse);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rockCollider : MonoBehaviour
{
public float thrust;
private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("test");
collision.rigidbody.AddForce(transform.forward * thrust);
}
}
......@@ -10,6 +10,8 @@ TagManager:
- Earth
- Water
- Fire
- Enemy
- EnemyShot
layers:
- Default
- TransparentFX
......@@ -43,15 +45,19 @@ TagManager:
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0
- name: Player
uniqueID: 1206248169
- name: Background
uniqueID: 1309380763
locked: 0
- name: Ground
uniqueID: 3814023117
locked: 0
- name: Player
uniqueID: 1206248169
locked: 0
- name: Foreground
uniqueID: 3680314903
locked: 0
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