Health system for ratbots, can now stab ratbots
This commit is contained in:
@@ -5,6 +5,7 @@ public class Ratbot : MonoBehaviour
|
||||
public float moveSpeed;
|
||||
public float damageStrength;
|
||||
public float damageTimeoutSeconds;
|
||||
public float health = 10;
|
||||
float lastDamageTime;
|
||||
GameState gameState;
|
||||
GameObject player;
|
||||
@@ -29,4 +30,10 @@ public class Ratbot : MonoBehaviour
|
||||
lastDamageTime = Time.fixedTime;
|
||||
collision.gameObject.GetComponent<Teo>().health -= damageStrength;
|
||||
}
|
||||
public void Damage(float hurtyAmount) {
|
||||
health -= hurtyAmount;
|
||||
if (health <= 0) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user