Commit 5154e18a authored by mthiele2's avatar mthiele2
Browse files

Stoff und Schnaps

parent 16147cea
......@@ -15,7 +15,7 @@ GameObject:
- component: {fileID: 5372445436103654034}
m_Layer: 0
m_Name: Destroyable_Thing
m_TagString: Untagged
m_TagString: DestroyableByFire
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -68,8 +68,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -614652393
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d0cee4e8b659c5646ac1e205b88a3256, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......
......@@ -278,12 +278,12 @@ PrefabInstance:
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_LocalPosition.x
value: 8.68
value: 1.33
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_LocalPosition.y
value: 3.5
value: 2.03
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
......@@ -313,7 +313,7 @@ PrefabInstance:
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
......@@ -666,7 +666,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4738352637052488, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
propertyPath: m_RootOrder
value: 5
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4738352637052488, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
......@@ -1181,16 +1181,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3962879857309384165, guid: 926b80f66a4f61b428fa10deff5f7842,
type: 3}
propertyPath: m_SortingLayerID
value: -614652393
objectReference: {fileID: 0}
- target: {fileID: 3962879857309384165, guid: 926b80f66a4f61b428fa10deff5f7842,
type: 3}
propertyPath: m_SortingLayer
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 926b80f66a4f61b428fa10deff5f7842, type: 3}
--- !u!1 &1156108368
......
......@@ -14,6 +14,9 @@ public class AI_WindAttack : WeightedAction
public float Cooldown;
public float attackRange;
public float firePower;
public int damage;
public float destroyTime;
public float thrust;
// Use this for initialization
void Start()
......@@ -33,10 +36,6 @@ public class AI_WindAttack : WeightedAction
return;
}
Vector2 dir = Vector2.zero;
direction = dir;
myAI.desiredAction.Add(this);
}
......@@ -65,9 +64,4 @@ public class AI_WindAttack : WeightedAction
Vector3 rotatedVector = Quaternion.AngleAxis(0, Vector3.forward) * attackdir;
body.velocity = new Vector2(rotatedVector.x * firePower, rotatedVector.y * firePower);
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
}
}
......@@ -3,10 +3,17 @@ using UnityEngine;
public class AI_WindProjectile : MonoBehaviour
{
public float destroyTime = 1f;
public float thrust;
private float destroyTime;
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()
{
......@@ -27,7 +34,7 @@ public class AI_WindProjectile : MonoBehaviour
dir.Normalize();
dir *= thrust;
other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse);
//other.attachedRigidbody.AddForce(Vector2.right*thrust, ForceMode2D.Impulse);
other.GetComponentInParent<Life>().Damage(damage);
}
Destroy();
}
......
......@@ -8,10 +8,11 @@ public class AI_FireAttack : WeightedAction
AI_Core myAI;
private float restCooldown;
public float Cooldown;
public float attackRange;
public float destroyTime;
public int damage;
public GameObject shot;
List<GameObject> shots;
public GameObject fireBall;
public float fireSpeed = 2f;
public int volleySize;
public int pooledAmount = 10;
......@@ -69,7 +70,7 @@ public class AI_FireAttack : WeightedAction
for (int i = 0; i < volleySize; i++)
{
launchPower += 3;
GameObject projectile = Instantiate(shot, shotspawn.position, shotspawn.rotation);
GameObject projectile = Instantiate(fireBall, shotspawn.position, shotspawn.rotation);
if (nearestPlayer.transform.position.x > this.transform.position.x)
{
projectile.GetComponent<Rigidbody2D>().velocity = new Vector2(launchPower, launchPower);
......
......@@ -2,46 +2,31 @@ using UnityEngine;
public class AI_FireProjectile : MonoBehaviour
{
public double damage;
public GameObject nearestPlayer;
/// <summary>
/// Bisher werden die Shots nach einer Sekunde auf inactive gesetzt
/// hier muss noch was mit Collidern eingefügt werden um
/// auf Zusammenstöße reagieren zu können, damit der Shot dann
/// auf inactive gesetzt wird
/// </summary>
public float destroyTime = 1f;
/// <summary>
/// Wenn das Geschoss auf active gesetzt wird, wird nach 2 Sekunden
/// die Destroy Methode aufgerufen
/// </summary>
private float destroyTime;
private float thrust;
private int damage;
private void Start()
{
AI_FireAttack fireAttack = GetComponentInParent<AI_FireAttack>();
destroyTime = fireAttack.destroyTime;
damage = fireAttack.damage;
}
void OnEnable()
void OnEnable()
{
Invoke("Destroy", destroyTime);
}
/// <summary>
/// Setzt das Geschoss auf 'inactive'
/// </summary>
void Destroy()
{
Destroy(gameObject);
}
/// <summary>
/// Beim Zusammenstoß mit einem anderen GameObject
/// </summary>
/// <param name="collision"></param>
private void OnTriggerEnter2D(Collider2D target)
{
if (target.CompareTag("Enemy"))
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
return;
other.GetComponentInParent<Life>().Damage(damage);
}
Destroy();
}
......
......@@ -50,7 +50,6 @@ public class AI_WandersV2 : WeightedAction
{
patrolSpot = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), -1);
dist = transform.position - patrolSpot;
Debug.Log("penis");
} while (dist.magnitude < 4f);
targetPos.position = patrolSpot;
......
......@@ -7,10 +7,8 @@ public class DestroyObject : MonoBehaviour {
void OnCollisionEnter2D(Collision2D other)
{
Debug.Log("pla");
if (other.gameObject.tag == "Fire")
{
Destroy(other.gameObject);
Destroy(gameObject);
}
}
......
......@@ -24,6 +24,10 @@ public class Player_FireProjectile : MonoBehaviour
collision.gameObject.GetComponent<Life>().Damage(1);
Destroy();
}
else if (collision.gameObject.CompareTag("DestroyableByFire"))
{
Destroy();
}
}
}
......@@ -12,6 +12,7 @@ TagManager:
- Fire
- Enemy
- EnemyShot
- DestroyableByFire
layers:
- Default
- TransparentFX
......
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