コード例 #1
0
ファイル: StateEditor.cs プロジェクト: midgithub/ProjectC
    public static string ToDescription(this StateItemType enumType)
    {
        Type type = typeof(StateItemType);

        try
        {
            FieldInfo info = type.GetField(enumType.ToString());
            if (info == null)
            {
                return("Unkown");
            }
            EnumDescriptionAttribute descAttribute = info.GetCustomAttributes(typeof(EnumDescriptionAttribute), true)[0] as EnumDescriptionAttribute;
            if (descAttribute != null)
            {
                return(descAttribute.Description);
            }
        }
        catch (Exception e)
        {
            Debug.LogWarning(e.Message);
        }
        return(type.ToString());
    }
コード例 #2
0
 private static int PerMinute(GameplayConstants constants, StateItemType type)
 {
     return(constants.GetChangePerMinute(type.ToString()));
 }
コード例 #3
0
 private static int InitValue(GameplayConstants constants, StateItemType type)
 {
     return(constants.GetInitialValue(type.ToString()));
 }
コード例 #4
0
    private int GetStat(StateItemType type)
    {
        switch (type)
        {
        case StateItemType.MyMaxEnergy:
            return(MyMaxEnergy);

        case StateItemType.MyEnergy:
            return(MyEnergy);

        case StateItemType.MyFood:
            return(MyFood);

        case StateItemType.MyHappiness:
            return(MyHappiness);

        case StateItemType.MyHealth:
            return(MyHealth);

        case StateItemType.FamilyFood:
            return(FamilyFood);

        case StateItemType.FamilyHappiness:
            return(FamilyHappiness);

        case StateItemType.FamilyHealth:
            return(FamilyHealth);

        case StateItemType.Age:
            return(Age);

        case StateItemType.Money:
            return(Money);

        case StateItemType.MySalary:
            return(MoneyPerWorkshift);

        case StateItemType.PartnerSalary:
            return(MoneyPerPartnersWorkshift);

        case StateItemType.FoodSupplies:
            return(FoodSupplies);

        default:
            throw new Exception("This type is not implemented in StatsDifference: " + type.ToString());
        }
    }