Commit f9ddf1ac authored by mthiele2's avatar mthiele2
Browse files

Is this the real life?

Is this just fantasy?
Caught in a landslide
No escape from reality
Open your eyes
Look up to the skies and see
I'm just a poor boy, I need no sympathy
Because I'm easy come, easy go
A little high, little low
Anyway the wind blows, doesn't really matter to me, to me
Mama, just killed a man
Put a gun against his head
Pulled my trigger, now he's dead
Mama, life had just begun
But now I've gone and thrown it all away
Mama, oh oh
Didn't mean to make you cry
If I'm not back again this time tomorrow
Carry on, carry on, as if nothing really matters
Too late, my time has come
Sends shivers down my spine
Body's aching all the time
Goodbye everybody I've got to go
Gotta leave you all behind and face the truth
Mama, oh oh (anyway the wind blows)
I don't want to die
Sometimes wish I'd never been born at all
parent 5b95de9a
......@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 114326583413855364}
- component: {fileID: 114716552753954768}
- component: {fileID: 7710007422906786959}
m_Layer: 13
m_Layer: 14
m_Name: Erd-Gegner
m_TagString: Enemy
m_Icon: {fileID: 0}
......@@ -133,8 +133,8 @@ MonoBehaviour:
weight: 1
isPerformingAction: 0
movementSpeed: 5
aggroRange: 0
dropAggroRange: 0
aggroRange: 6
dropAggroRange: 7
--- !u!58 &7710007422906786959
CircleCollider2D:
m_ObjectHideFlags: 0
......@@ -162,7 +162,7 @@ GameObject:
- component: {fileID: 5151316259711694663}
- component: {fileID: 7574451920411087056}
- component: {fileID: 5069815732207941033}
m_Layer: 13
m_Layer: 14
m_Name: Erdangriff
m_TagString: Untagged
m_Icon: {fileID: 0}
......
......@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 212219553255752332}
- component: {fileID: 114326583413855364}
- component: {fileID: 5627041003248903908}
m_Layer: 13
m_Layer: 14
m_Name: Feuer-Gegner
m_TagString: Fire
m_Icon: {fileID: 0}
......@@ -51,7 +51,7 @@ Rigidbody2D:
m_Mass: 10000
m_LinearDrag: 5
m_AngularDrag: 0.05
m_GravityScale: 0
m_GravityScale: 3
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
......@@ -160,7 +160,6 @@ MonoBehaviour:
isPerformingAction: 0
Cooldown: 2
attackRange: 8
destroyTime: 1
damage: 1
fireBall: {fileID: 1870586037468468, guid: 61411254df3161c4e81f6c0a4f2cd33c, type: 3}
volleySize: 3
......@@ -176,7 +175,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2944414297440889058}
m_Layer: 13
m_Layer: 14
m_Name: ShotSpawn
m_TagString: Untagged
m_Icon: {fileID: 0}
......
......@@ -16,7 +16,7 @@ GameObject:
- component: {fileID: 7642390674257080637}
- component: {fileID: 2887302863579586647}
- component: {fileID: 380768153646748734}
m_Layer: 13
m_Layer: 14
m_Name: Wasser-Gegner
m_TagString: Water
m_Icon: {fileID: 0}
......@@ -201,7 +201,7 @@ GameObject:
- component: {fileID: 4632333845714261479}
- component: {fileID: 630870635}
- component: {fileID: 630870634}
m_Layer: 13
m_Layer: 14
m_Name: GroundCheck
m_TagString: Untagged
m_Icon: {fileID: 0}
......
......@@ -16,7 +16,7 @@ GameObject:
- component: {fileID: 114716552753954768}
- component: {fileID: 8582909611794385439}
- component: {fileID: 879798643589630551}
m_Layer: 13
m_Layer: 14
m_Name: Wind-Gegner
m_TagString: Enemy
m_Icon: {fileID: 0}
......@@ -178,7 +178,7 @@ MonoBehaviour:
weight: 1
isPerformingAction: 0
patrolRange: 5
targetPos: {fileID: 0}
targetPos: {fileID: 1344694553418298308}
moveTime: 2
chillTime: 0.5
--- !u!114 &879798643589630551
......@@ -211,7 +211,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1344694553418298308}
m_Layer: 13
m_Layer: 14
m_Name: Patrolspot
m_TagString: Untagged
m_Icon: {fileID: 0}
......
......@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 212152556601460820}
- component: {fileID: 53005818070376170}
m_Layer: 0
m_Name: Pre_WindAttacke
m_Name: EnemyWindAttack
m_TagString: EnemyShot
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -131,5 +131,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7e39d42d43f2d404ba22f886e573cae1, type: 3}
m_Name:
m_EditorClassIdentifier:
destroyTime: 1
thrust: 10
destroyTime: 0
thrust: 0
damage: 0
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3565338863107458340
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3565338863107458341}
- component: {fileID: 3565338863107458343}
- component: {fileID: 3565338863107458342}
m_Layer: 0
m_Name: BackgroundCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3565338863107458341
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863107458340}
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: 3565338863782319726}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &3565338863107458343
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863107458340}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 10
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 8192
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &3565338863107458342
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863107458340}
m_Enabled: 0
--- !u!1 &3565338863782320019
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3565338863782319726}
- component: {fileID: 3565338863782319725}
- component: {fileID: 3565338863782319724}
- component: {fileID: 3565338863782319727}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3565338863782319726
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863782320019}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 77.08, y: 49.679996, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3565338863107458341}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &3565338863782319725
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863782320019}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 3
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 66
orthographic: 1
orthographic size: 8
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 24375
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &3565338863782319724
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863782320019}
m_Enabled: 1
--- !u!114 &3565338863782319727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565338863782320019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53e622d25d5bf8b45be54c49c309108d, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
smoothSpeed: 0.5
lookAt: 0
maxDistance: 5
fileFormatVersion: 2
guid: d467d6f6bef5f8a44a20713cc2de4025
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -4,7 +4,7 @@ using System.Collections;
public class AI_WindAttack : WeightedAction
{
GameObject nearestPlayer;
GameObject target;
AI_Core myAI;
private float restCooldown;
......@@ -26,12 +26,7 @@ public class AI_WindAttack : WeightedAction
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (dist > attackRange)
if (myAI.rangeCheckFailed(transform, attackRange))
{
return;
}
......@@ -41,7 +36,9 @@ public class AI_WindAttack : WeightedAction
public override void performAction()
{
Vector3 attackdir = nearestPlayer.transform.position - transform.position;
target = GameObject.FindGameObjectWithTag("Player");
Vector3 attackdir = target.transform.position - transform.position;
attackdir.Normalize();
if (restCooldown <= 0)
......@@ -59,6 +56,7 @@ public class AI_WindAttack : WeightedAction
public void Fire(Vector3 attackdir)
{
GameObject projectile = Instantiate(windAttack, transform.position + attackdir, Quaternion.AngleAxis(Mathf.Atan2(-attackdir.y, -attackdir.x) * Mathf.Rad2Deg + 180, Vector3.forward));
projectile.GetComponent<AI_WindProjectile>().setValues(damage, destroyTime, thrust);
body = projectile.GetComponent<Rigidbody2D>();
Vector3 rotatedVector = Quaternion.AngleAxis(0, Vector3.forward) * attackdir;
......
......@@ -7,20 +7,6 @@ public class AI_WindProjectile : MonoBehaviour
private float thrust;
private int damage;
private void Start()
{
AI_WindAttack windattack = GetComponentInParent<AI_WindAttack>();
destroyTime = windattack.destroyTime;
thrust = windattack.thrust;
damage = windattack.damage;
}
void OnEnable()
{
Invoke("Destroy", destroyTime);
}
void Destroy()
{
Destroy(gameObject);
......@@ -37,7 +23,15 @@ public class AI_WindProjectile : MonoBehaviour
other.GetComponentInParent<Life>().Damage(damage);
}
Destroy();
}
}
public void setValues(int damage, float destroyTime, float thrust)
{
this.damage = damage;
this.destroyTime = destroyTime;
this.thrust = thrust;
Invoke("Destroy", destroyTime);
}
}
......@@ -4,13 +4,14 @@ using System.Collections;
public class AI_FireAttack : WeightedAction
{
GameObject nearestPlayer;
GameObject target;
AI_Core myAI;
private float restCooldown;
public float Cooldown;
public float attackRange;
public int damage;
public float destroyTime;
public GameObject fireBall;
public int volleySize;
public float launchPower;
......@@ -27,12 +28,7 @@ public class AI_FireAttack : WeightedAction
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (dist > attackRange)
if (myAI.rangeCheckFailed(transform, attackRange))
{
return;
}
......@@ -55,13 +51,14 @@ public class AI_FireAttack : WeightedAction
IEnumerator fireVolley()
{
target = GameObject.FindGameObjectWithTag("Player");
launchPower = 10;
for (int i = 0; i < volleySize; i++)
{
launchPower += 3;
GameObject projectile = Instantiate(fireBall, shotspawn.position, shotspawn.rotation);
projectile.GetComponent<AI_FireProjectile>().damage = damage;
if (nearestPlayer.transform.position.x > this.transform.position.x)
projectile.GetComponent<AI_FireProjectile>().setValues(damage, destroyTime);
if (target.transform.position.x > this.transform.position.x)
{
projectile.GetComponent<Rigidbody2D>().velocity = new Vector2(launchPower, launchPower);
}
......
......@@ -2,7 +2,13 @@ using UnityEngine;
public class AI_FireProjectile : MonoBehaviour
{
public int damage;
private int damage;
private float destroyTime;
void Destroy()
{
Destroy(gameObject);
}
private void OnTriggerEnter2D(Collider2D other)
{
......@@ -16,5 +22,12 @@ public class AI_FireProjectile : MonoBehaviour
}
Destroy(gameObject);
}
public void setValues(int damage, float destroyTime)
{
this.damage = damage;
this.destroyTime = destroyTime;
Invoke("Destroy", destroyTime);
}
}
......@@ -43,6 +43,10 @@ public class AI_Core : MonoBehaviour {
public GameObject findNearestPlayer()
{
GameObject player = GameObject.FindGameObjectWithTag("Player");
if(player == null)
{
return null;
}
if (player.transform.position.x > this.transform.position.x)
{
transform.eulerAngles = new Vector3(0, 0, 0);
......@@ -53,4 +57,19 @@ public class AI_Core : MonoBehaviour {
}
return player;
}
public bool rangeCheckFailed(Transform pos, float range)
{
GameObject nearestPlayer = findNearestPlayer();
if (nearestPlayer == null)
{
return true;
}
else if(Vector2.Distance(pos.position, nearestPlayer.transform.position) > range)
{
return true;
}
return false;
}
}
......@@ -4,7 +4,7 @@ using System.Collections;
public class AI_Follows : WeightedAction
{
GameObject nearestPlayer;
GameObject target;
AI_Core myAI;
......@@ -31,18 +31,14 @@ public class AI_Follows : WeightedAction
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector3.Distance(transform.position, nearestPlayer.transform.position);
if (dist > dropAggroRange)
if (myAI.rangeCheckFailed(transform, dropAggroRange))
{
isFollowing = false;
}
if (!isFollowing)
{
if (dist > aggroRange)
if (myAI.rangeCheckFailed(transform, aggroRange))
{
return;
}
......@@ -54,6 +50,8 @@ public class AI_Follows : WeightedAction
public override void performAction()
{
transform.position = Vector2.MoveTowards(transform.position, nearestPlayer.transform.position, movementSpeed * Time.deltaTime);
target = GameObject.FindGameObjectWithTag("Player");
transform.position = Vector2.MoveTowards(transform.position, target.transform.position, movementSpeed * Time.deltaTime);
}
}
......@@ -34,8 +34,8 @@ public class Life : MonoBehaviour {
}
public void Death(){
//Reset
Destroy(gameObject);
//Reset
gameObject.SetActive(false);
Debug.Log("Death");
}
......
......@@ -23,17 +23,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Air
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (dist > attackRange)
{
return;
}
myAI.desiredAction.Add(this);
}
public override void performAction()
......
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
......@@ -20,7 +20,8 @@ public class HealthBar : MonoBehaviour
// Update is called once per frame
void Update()
{
}
HealthUpdate();
}
public void HealthUpdate()
{
......
......@@ -28,7 +28,7 @@ TagManager:
- Elements
- ElementalAttacks
- BackgroundTileMap
-
- Enemy
-
-