Пример #1
0
    public override void Die(Vector3 impactForce)
    {
        ui.DamageKing(1f / numberOfHitsToKillKing);
        DamageEffects();

        if (ui.GetHealthValue() <= 0)
        {
            TimeKeeper.Deregister(this);
            Rigidbody rb = modelTransform.gameObject.GetComponent <Rigidbody>();
            if (rb != null)
            {
                sndSrc.Stop();
                sndSrc.PlayOneShot(kingDead);
                int corpsesLayer = LayerMask.NameToLayer("Corpses");
                gameObject.layer = corpsesLayer;
                modelTransform.gameObject.layer = corpsesLayer;
                rb.isKinematic = false;
                rb.AddForce(impactForce * deathForceMultiplier, ForceMode.Impulse);
                userInterface.FailureState();
            }
        }
        else
        {
            ui.ShowAlertText();
        }
    }
    public virtual void Die(Vector3 impactForce)
    {
        TimeKeeper.Deregister(this);
        Rigidbody rb = modelTransform.gameObject.GetComponent <Rigidbody>();

        if (rb != null)
        {
            int corpsesLayer = LayerMask.NameToLayer("Corpses");
            gameObject.layer = corpsesLayer;
            modelTransform.gameObject.layer = corpsesLayer;
            rb.isKinematic = false;
            rb.AddForce(impactForce * deathForceMultiplier, ForceMode.Impulse);
        }
    }
 private void OnDestroy()
 {
     TimeKeeper.Deregister(this);
 }