如果你想要让掷骰子的活动里行动点变化的同时不会影响饱食度,你可以修改 AddActionPoint 方法如下:

public void AddActionPoint(int point)
{
    this.playerData.actionPoint.Value += point;
    if (point < 0)
    {
        if (playerData.hungry <= 40)
        {
            AddHealth(point * 10);
        }
        else
        {
            AddHungry(point * 5);
        }
    }
}

这样,只有当饱食度小于等于40时,才会减少健康值。否则,只会减少饱食度。这样就可以实现行动点变化的同时不影响饱食度。

另外,在你的 StartEvent 方法中,你可以调用 AddActionPoint 方法来改变行动点。例如:

private IEnumerator StartEvent()
{
    bool Success = true;
    // 扔骰子
    if (RollDice == true)
    {
        DiceRandomPanel dicePanel = UIKit.OpenPanel<DiceRandomPanel>();

        while (!UnityObjectUtility.IsDestroyed(dicePanel))
        {
            // 等待半秒钟
            yield return new WaitForSeconds(0.5f);
        }
        // 取出骰子结果进行比对
        if (DiceRandomPanel.RollResult < winRoll)
        {
            // 应用失败的Influence
            Success = false;
        }
    }
    if (Success)
    {
        // 优先influence
        ApplyInfluence(influence);
    }
    else
    {
        ApplyInfluence(defeatInfluence);
        AddActionPoint(-1); // 行动点减1
    }
}

这样,当骰子结果小于胜利点数时,会应用失败的 Influence 并减少行动点。


原文地址: https://www.cveoy.top/t/topic/phg6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录