Explosion particles now
This commit is contained in:
@@ -73,6 +73,7 @@ public class GameState : MonoBehaviour
|
||||
wave++;
|
||||
}
|
||||
public GameObject SpawnRatbot() {
|
||||
return creeper;
|
||||
// TODO: Convert this mess into a switch case
|
||||
if (counts[(uint)CountIndex.gunThrower] < wave/3
|
||||
&& wave > 2
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Creeper : Ratbot
|
||||
{
|
||||
public GameObject particles;
|
||||
float countdown;
|
||||
|
||||
void Update() {
|
||||
if (Vector3.Distance(player.transform.position, transform.position) > 5) {
|
||||
MoveTowardsPlayer(moveSpeed);
|
||||
float newTime = countdown + Time.deltaTime;
|
||||
countdown = (newTime < 1) ? newTime : 1;
|
||||
countdown = Mathf.Min(newTime, 1);
|
||||
} else {
|
||||
countdown -= Time.deltaTime;
|
||||
if (countdown < 0) Explode();
|
||||
}
|
||||
transform.GetChild(0).localScale = new Vector3 (countdown * 3.5F, 0.25F, 1);
|
||||
}
|
||||
void Explode() {
|
||||
Destroy(gameObject);
|
||||
Instantiate(particles);
|
||||
if (Vector3.Distance(player.transform.position, transform.position) < 5) {
|
||||
player.GetComponent<Teo>().health -= damageStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user