Exemple #1
0
    /// <summary>
    /// Update a players health based on a health pack (host)
    /// </summary>
    /// <param name="splitCode">The message data from the packets</param>
    internal void HealthPlayer(string[] splitCode)
    {
        int   id     = int.Parse(splitCode[1]);
        float health = float.Parse(splitCode[2]);

        IHaveHealth target = network.GetPlayerOfID(id).GetComponent(typeof(IHaveHealth)) as IHaveHealth;

        target.GainHealth(health);

        if (splitCode.Length >= 4)
        {
            int boxID = int.Parse(splitCode[3]);
            EventHealthPickUp(boxID);
        }
    }
Exemple #2
0
 public void GainHealth(float amount)
 {
     parentHealth.GainHealth(amount);
 }
Exemple #3
0
    /// <summary>
    /// Update the health of a player based on a health pack (client)
    /// </summary>
    /// <param name="id"> ID of the player to heal </param>
    /// <param name="health"> The amount to heal the player. </param>
    internal void HealthPlayer(int id, float health)
    {
        IHaveHealth target = network.GetPlayerOfID(id).GetComponent(typeof(IHaveHealth)) as IHaveHealth;

        target.GainHealth(health);
    }