Пример #1
0
 public void Heal(int Amount)
 {
     OnScreenDisplay.SetHealthPoints(health + (int)Amount, false);
     OnScreenDisplay.PostMessage("Plus " + Amount + " health!", Color.green);
     if (health + Amount > 100)
     {
         health = 100;
     }
     else
     {
         audio.PlayOneShot(powerUp);
         health += Amount;
     }
 }
Пример #2
0
 public void Harm(int damage)
 {
     FlashLight.Injury();
     health -= damage;
     OnScreenDisplay.SetHealthPoints((int)health, false);
     //Debug.Log (health);
     if (health <= 0)
     {
         Die();
     }
     else
     {
         audio.Play();
         OnScreenDisplay.PostMessage("Taking Damage!", Color.red);
     }
 }
Пример #3
0
    public static void RestartGame()
    {
        // return player to above the grid
        GameObject fpc = GameObject.Find("First Person Controller");

        fpc.transform.position = new Vector3(0, 3, 0);

        // reset first person health
        fpc.GetComponent <CharacterScript> ().ResetHealth();
        OnScreenDisplay.SetHealthPoints(100, false);

        // reset flashlight value
        FlashLight.UpdateBattery(100, false);

        // set game mode
        mode = GameMode.StartMenu;
    }