Esempio n. 1
0
 //Takes Energy when player is doing certain actions
 private void SpendEnergy(PlayerController.PlayerAction lastPlayerAction)
 {
     switch (lastPlayerAction)
     {
     case PlayerController.PlayerAction.Jump:
         ChangeEnergy(-jumpEnergy);
         break;
     }
 }
Esempio n. 2
0
    public bool HasEnergyForAction(PlayerController.PlayerAction lastPlayerAction)
    {
        float energyToSpend = 0;

        switch (lastPlayerAction)
        {
        case PlayerController.PlayerAction.Jump:
            energyToSpend = jumpEnergy;
            break;
        }
        return(currentEnergy > energyToSpend);
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (lastPlayerAction != playerController.playerAction)
        {
            lastPlayerAction = playerController.playerAction;
            if (HasEnergyForAction(lastPlayerAction))
            {
                SpendEnergy(lastPlayerAction);
            }
        }
        else if (lastPlayerAction == PlayerController.PlayerAction.HangUp)
        {
            ChangeEnergy(-hangUpEnergy);
        }

        FillEnergy();
        energyBar.GetComponent <BarController>().barQuantity = currentEnergy;
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     playerController = GetComponent <PlayerController>();
     lastPlayerAction = playerController.playerAction;
     energyBar.GetComponent <BarController>().barQuantity = currentEnergy;
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     playerController = GetComponent <PlayerController>();
     lastPlayerAction = playerController.playerAction;
     lifeBar.GetComponent <BarController>().barQuantity = currentLife;
 }