示例#1
0
文件: Player.cs 项目: wolfrug/ldjam45
    public void SetRegenSpeed(InteractableColor type, float newRegen)
    {
        switch (type)
        {
        case InteractableColor.RED:
        {
            PlayerUI.instance.redSlider.regenSpeed = newRegen;
            break;
        }

        case InteractableColor.BLUE:
        {
            PlayerUI.instance.blueSlider.regenSpeed = newRegen;
            break;
        }

        case InteractableColor.GREEN:
        {
            PlayerUI.instance.greenSlider.regenSpeed = newRegen;
            break;
        }

        default:
        {
            Debug.LogWarning("Tried to set regen speed on null value!");
            break;
        }
        }
    }
示例#2
0
文件: Player.cs 项目: wolfrug/ldjam45
 public void UpdatePlayerAbilities(InteractableColor color)
 {
     UpdatePlayerSpeedAndJump();
     SetRegenSpeed(InteractableColor.GREEN, GameManager.instance.GreenStatMax / 5f);
     SetRegenSpeed(InteractableColor.RED, GameManager.instance.RedStatMax / 5f);
     SetRegenSpeed(InteractableColor.BLUE, GameManager.instance.BlueStatMax / 5f);
 }
示例#3
0
    public float GetStatMax(InteractableColor type)
    {
        switch (type)
        {
        case InteractableColor.BLUE:
        {
            return(BlueStatMax);
        }

        case InteractableColor.RED:
        {
            return(RedStatMax);
        }

        case InteractableColor.GREEN:
        {
            return(GreenStatMax);
        }

        default:
        {
            Debug.LogWarning("Did not assign any stat type to raise!");
            return(0f);
        }
        }
    }
示例#4
0
    public void AddStat(InteractableColor type, float amount)
    {
        switch (type)
        {
        case InteractableColor.BLUE:
        {
            BlueStatMax += Mathf.Clamp(amount, 1f, 100f);
            statUpdateEvent.Invoke(InteractableColor.BLUE);
            break;
        }

        case InteractableColor.RED:
        {
            RedStatMax += Mathf.Clamp(amount, 1f, 100f);
            statUpdateEvent.Invoke(InteractableColor.RED);
            break;
        }

        case InteractableColor.GREEN:
        {
            GreenStatMax += Mathf.Clamp(amount, 1f, 100f);
            statUpdateEvent.Invoke(InteractableColor.GREEN);
            break;
        }

        default:
        {
            Debug.LogWarning("Did not assign any stat type to raise!");
            break;
        }
        }
        PlayerUI.instance.UpdateSliders();
        audioSource.SetClip(gainStatSound, false);
        audioSource.Play();
    }
示例#5
0
 void UpdateSelf(InteractableColor updateColor)
 {
     //Debug.Log ("Received update for " + updateColor + " for slider " + color);
     if (color == updateColor)
     {
         maxValue = GameManager.instance.GetStatMax(color);
         Mathf.Clamp(value, 0f, maxValue);
     }
 }
示例#6
0
 public void UpdateSliders(InteractableColor type)    // Listens to game manager events on updates
 {
     redSlider.maxValue   = GameManager.instance.RedStatMax;
     greenSlider.maxValue = GameManager.instance.GreenStatMax;
     blueSlider.maxValue  = GameManager.instance.BlueStatMax;
 }