Beispiel #1
0
 public void Reset()
 {
     if (bar == null)
     {
         bar = GetComponent <EnergyBar>();
     }
     bar.ChargeToMin(0f);
 }
Beispiel #2
0
    private void Update()
    {
        float value = 0f;

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            value = energyBar.max / 10f;
            energyBar.AddValue(value);
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            value = energyBar.max / 10f * -1.0f;
            energyBar.AddValue(value);
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            value = angryBar.max / 10f;
            angryBar.AddValue(value);
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            value = angryBar.max / 10f * -1.0f;
            angryBar.AddValue(value);
        }

        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            energyBar.ChargeToMax();
        }

        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            energyBar.ChargeToMin();
        }
    }