コード例 #1
0
ファイル: LogicHelper.cs プロジェクト: tymbark/castlesUnity3d
    public static int HowManyWorkersNeeded(CardDice actionDice, CardDice targetDice)
    {
        if (actionDice == CardDice.All)
        {
            return(0);
        }

        switch (Mathf.Abs(actionDice.ToInt() - targetDice.ToInt()))
        {
        case 0:
            return(0);

        case 1:
        case 5:
            return(1);

        case 2:
        case 4:
            return(2);

        case 3:
            return(3);

        default:
            throw new System.InvalidProgramException("Illegal value in difference between two dices!");
        }
    }