コード例 #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());
        }
    }
コード例 #2
0
 void Update()
 {
     if (TextComp != null && ShieldTested != null)
     {
         TextComp.text = ShieldTested.GetMinionCount().ToString();
     }
 }