public void takeDamage(float damage, bool crit) { if (crit) { damage = damage * 2; CritFloatingTextController.CreateFloatingText(damage.ToString(), MyTransform, distance, crit); } else { FloatingTextController.CreateFloatingText(damage.ToString(), MyTransform, distance, crit); } health = health - damage; if (health <= 0) { ai.SetDestination(MyTransform.position); animator.SetBool("Die", true); body.enabled = false; head.enabled = false; if (body1 != null) { body1.enabled = false; } if (head1 != null) { head1.enabled = false; } Dead(); } }
// public Vector2 position; // Start is called before the first frame update void Start() { MusicSource.clip = Firing; MyTransform = this.transform; MyCameraTransform = Camera.main.transform; animator.SetBool("Walk", true); FloatingTextController.Initalize(); CritFloatingTextController.Initalize(); }