コード例 #1
0
ファイル: Citizen.cs プロジェクト: gsx95/colonize
    private void Consume(ResourceHolder.ResType resType, float amount = 1f)
    {
        var satisfiying = ResourceHolder.ConsumeAllLeft(resType, amount);

        if (satisfiying)
        {
            var currentLevel = satisfaction[resType];
            if (currentLevel == SatisfactionLevel.FULL)
            {
                return;
            }
            satisfaction[resType] = currentLevel + 1;
        }
        else
        {
            var currentLevel = satisfaction[resType];
            if (currentLevel == SatisfactionLevel.NONE)
            {
                return;
            }
            satisfaction[resType] = currentLevel - 1;
        }
    }
コード例 #2
0
 public ResAmount(ResourceHolder.ResType resType, float amount)
 {
     this.resType = resType;
     this.amount  = amount;
 }