public override void Dead(bool destroy) { if (destroy) { if (State == State.Dead) { Instantiate(_destroyParticle, transform.position, Quaternion.identity); AudioManager.PlayClipAtPosition(_destroyClip, transform.position, 1f, 1f, Random.Range(.5f, 1f)); Destroy(gameObject); } else { _target = null; FightStage.DefenderDied(); SwitchState(State.Dead); _rigidBody.useGravity = false; GetComponent <Collider>().isTrigger = true; //AudioManager.PlayClipAtPosition(_deadClip, transform.position); Invoke(nameof(SelfDestroy), 1.5f); } } else { SwitchState(State.Dead); AudioManager.PlayClipAtPosition(_deadClip, transform.position); Destroy(gameObject, 5f); } gameObject.tag = "Dead"; }
public virtual void Dead(bool destroy) { if (gameObject.tag == "Defender") { FightStage.DefenderDied(); } if (destroy) { Instantiate(_destroyParticle, transform.position, Quaternion.identity); AudioManager.PlayClipAtPosition(_destroyClip, transform.position, 1f, 1f, Random.Range(.5f, 1f)); Destroy(gameObject); } else { SwitchState(State.Dead); AudioManager.PlayClipAtPosition(_deadClip, transform.position); Destroy(gameObject, 5f); } gameObject.tag = "Dead"; }