Beispiel #1
0
    //--------------------------------------------------------------
    // *** HEALTH ***

    public void Damage(Character instigator, float amount)
    {
        // Damage character based on amount passed through
        _Health -= (int)amount;

        // Check if minion character has no health
        if (_Health <= 0)
        {
            // Clamp health to 0
            _Health = 0;

            // Detach & hide minion (NOT DELETED)
            transform.parent   = null;
            transform.position = new Vector3(1000, 0, 1000);

            // Deduct from weapon's minion count thats associated with this minion
            GetComponent <Renderer>().enabled = false;
            Wep_Shield wep = GameObject.FindGameObjectWithTag(string.Concat("P" + GetOwner().GetOwner()._Player._pPlayerID + "_ShieldWeapon")).GetComponent <Wep_Shield>();
            wep.SetMinionCount(wep.GetMinionCount() - 1);

            // Set player associated with the minion's score
            wep.GetOwner()._Player.SetScore(wep.GetMinionCount());

            // Add movement speed from the player associated to the shield
            wep.GetOwner().SetMovementSpeed(wep.GetOwner().GetMovementSpeed() + WeaponManager._pInstance._MovementSpeedSap);

            // Remove from weapon pool
            wep.GetMeatMinionPool().Remove(this.gameObject);

            // Set new score
            wep.GetOwner()._Player.SetScore(wep.GetMinionCount());
        }
    }
    public override void OnDeath(Character instigator) {

        // Get last known alive position and store it
        base.OnDeath(instigator);

        // Destroy all minions in the character's shield
        Wep_Shield shield = _WeaponSpecial.GetComponent<Wep_Shield>();
        foreach (var item in shield.GetMeatMinionPool()) {

            Proj_ShieldMinion minion = item.GetComponent<Proj_ShieldMinion>();
            minion.ForceDeath();
        }

        // Play OnDeath effect
        if (_EffectOnDeath != null)
            Instantiate(_EffectOnDeath, transform.position, Quaternion.identity);
        
        if (_Player.GetRespawnsLeft() > 0) {
            
            // Disable controller input
            _Active = false;

            // Deduct life from respawn cap
            _Player.DeductRespawn();

            // Move character to its respawn point
            gameObject.transform.position = _RespawnPoint.position;

            // Start respawn timer
            _WaitingToRespawn = true;
        }

        // Player is out of lives and is eliminated from the match
        else {

            // Deduct life from respawn cap
            _Player.DeductRespawn();

            // hide character & move out of playable space
            GetComponentInChildren<Renderer>().enabled = false;
            transform.position = new Vector3(1000, 0, 1000);

            // Show popup that a player has been eliminated
            MatchManager._pInstance.OnPlayerEliminated(_Player);

            // Find self in active pool
            foreach (var necromancer in PlayerManager._pInstance.GetActiveNecromancers()) {

                // Once we have found ourself in the pool
                if (necromancer == this) {

                    // Move to inactive pool
                    PlayerManager._pInstance.GetEliminatedNecromancers().Add(necromancer);
                    PlayerManager._pInstance.GetActiveNecromancers().Remove(necromancer);
                    break;
                }
            }
            
            // Set our match placement depending on how many other players are still alive in the game
            int playersRemaining = PlayerManager._pInstance.GetActiveNecromancers().Count;
            _Player.SetPlacement(playersRemaining + 1);

            // Disable controller input
            _Active = false;
        }

        // Instigator plays a taunt
        if (instigator.GetComponent<Char_Geomancer>().GetDialog() != null)
            instigator.GetComponent<Char_Geomancer>().GetDialog().PlayTaunt();

        // Play death sound
        if (_CharacterDialog != null)
            _CharacterDialog.PlayOnDeath();
    }
Beispiel #3
0
 public void AddToPool(Wep_Shield weapon)
 {
     weapon.GetMeatMinionPool().Add(this.gameObject);
 }