public void GetHit(float damage) { m_CurrentHealth -= damage; healthBar.value = m_CurrentHealth; if (HitPlayer != null) { HitPlayer.PlayRandom(); } if (m_CurrentHealth > 0) { gameObject.SendMessage("GetsProvoked"); return; } Vector3 position = transform.position; //the audiosource of the target will get destroyed, so we need to grab a world one and play the clip through it if (HitPlayer != null) { var source = WorldAudioPool.GetWorldSFXSource(); source.transform.position = position; source.pitch = HitPlayer.source.pitch; source.PlayOneShot(HitPlayer.GetRandomClip()); } if (DestroyedEffect != null) { var effect = PoolSystem.Instance.GetInstance <ParticleSystem>(DestroyedEffect); effect.time = 0.0f; effect.Play(); effect.transform.position = position; } m_Destroyed = true; gameObject.SetActive(false); GameSystem.Instance.TargetDestroyed(pointValue); }
public void PlayFootstep() { FootstepPlayer.PlayRandom(); }