IEnumerator Reach() { yield return(new WaitForSeconds(info.time)); onExplosion.Invoke(info); Destroy(this); }
/// <summary> /// Simulates the effect of getting hit by an explosion. /// </summary> public virtual void ExplosionEffect(float intensity) { m_PlayerHealthSource.ForcePlay(m_ExplosionNoise, m_ExplosionNoiseVolume); m_StunnedSnapshot.TransitionTo(0.1f); float duration = m_DeafnessDuration.x + (m_DeafnessDuration.y - m_DeafnessDuration.x) * intensity; Invoke(nameof(SetNormalSnapshot), duration); ExplosionEvent?.Invoke(); }
void Explode() { ExplosionEvent.Invoke(this, transform.position, correctArea); }
void ProjectileExploded(Projectile projectile, Vector3 position, bool correctArea) { ResetProjectile(projectile); ExplosionEvent.Invoke(position, correctArea); }
public bool RecieveExplosion(Explosion.ExplosionInfo info) { if (HasFlag(ExplosionResponse.None)) { return(false); } Vector3 direction = transform.position - info.explosionCenter; Vector3 blast = Vector3.Scale(direction.normalized, info.forceMultipliers); //Debug.Log("I have recieved an explosion\t" + name + "\n\tForce: " + forceMultipliers); if (HasFlag(ExplosionResponse.Rigidbody)) { if (rb != null) { if (rb.isKinematic && info.source.RemoveKinematicAttribute) { rb.isKinematic = false; rb.useGravity = true; } //Debug.Log("Applying force to " + name + "\n"); rb.AddForce(blast, ForceMode.Impulse); } } if (HasFlag(ExplosionResponse.Haptics)) { if (info.explosionSequence != null) { var Where = HardlightSuit.Find().FindNearestFlag(info.explosionCenter, 5); HardlightSuit.Find().EmanatingHit(Where, info.explosionSequence, .25f, 8); } } if (HasFlag(ExplosionResponse.Fireworks)) { //Create a visual effect at the point of impact? } if (HasFlag(ExplosionResponse.ChainReaction)) { StartCoroutine(StartChainReaction(info)); } if (HasFlag(ExplosionResponse.Destroyable)) { Destroyable breakable = GetComponent <Destroyable>(); if (breakable != null) { //Debug.Log(info.BlastStrength() + " \n" + blast + "\n"); breakable.DestroyableHit(info.BlastStrength(), blast); } } if (HasFlag(ExplosionResponse.CallScript)) { if (WhenExploded != null) { WhenExploded.Invoke(info); } //Delegate to call if (HitByExplosionDelegate != null) { HitByExplosionDelegate.Invoke(info); } } return(true); }
/// <summary> /// Функция, выключающая объект /// </summary> public void DisableObj() { gameObject.SetActive(false); ObjectDisabledEvent.Invoke(this); }
private void OnExplosionAnimationFinished() { OnExplosionFinished?.Invoke(this); Destroy(gameObject); }
private void OnExplosion(double top, double left, double width, double height) { ExplosionEvent?.Invoke(this, top, left, width, height); }