Example #1
0
    private void testPlayerGetDamaged(string playerName_, float damage)
    {
        foreach (GameObject player in onlinePlayerList)
        {
            NetworkPlayerController tempNPC = player.GetComponent <NetworkPlayerController>();

            // Debug record
            float cHealth = tempNPC.health;

            if (tempNPC.playerName == playerName_)
            {
                tempNPC.getDamage(damage);
                Debug.Log(tempNPC.playerName + " is hit! Damage: " + damage);
            }

            if (cHealth - damage < 0.0f)
            {
                Debug.Assert(tempNPC.health.Equals(0.0f));
            }
            else
            {
                Debug.Assert(tempNPC.health.Equals(cHealth - damage));
            }

            break;
        }
    }