Ejemplo n.º 1
0
    } // apply damage

    void CharacterDied()
    {
        if (isPlayer)
        {
            Debug.Log("Player Died!");
            _animations.DeadAnims(Random.Range(0, 2));
            _playerController.enabled = false;
            _playerMovement.enabled   = false;
            GetComponent <CapsuleCollider>().enabled = false;
            _rigidbody.constraints      = RigidbodyConstraints.FreezePosition;
            _shootingController.enabled = false;
            // GameManager.instance.RestartGame();

            StartCoroutine(PlayerDeadEvent());
        }

        if (isEnemy || isFinalEnemy)
        {
            _animations.StopAllanimations();
            _animations.DeadAnims(Random.Range(0, 2));
            _enemyController.enabled = false;
            _navMeshAgent.enabled    = false;
            Rigidbody rb = GetComponent <Rigidbody>();
            rb.constraints = RigidbodyConstraints.FreezeAll;
            Debug.Log("Enemy Died" + gameObject.name);

            // add player exp
            UnlockCombos.instance.myexp += 5;

            //if (isFinalEnemy)
            //{
            //    finalEnemyDeadCheck.FinalEnemyIsDead();
            //}
        }

        if (isViper)
        {
            _animations.StopAllanimations();
            _animations.ViperDeadAnim();
            _viperController.enabled = false;
            _navMeshAgent.enabled    = false;
            _enemyAudio.enabled      = false;
            GetComponent <SphereCollider>().enabled = false;
            GetComponent <BoxCollider>().enabled    = false;
            enabled = false;

            // add player exp
            UnlockCombos.instance.myexp += 10;
        }
    }