コード例 #1
0
ファイル: Cell.cs プロジェクト: duanma/ai-planner-samples
        public void SetField(string fieldName, object value)
        {
            switch (fieldName)
            {
            case nameof(Type):
                Type = (Generated.Semantic.Traits.Enums.CellType)Enum.ToObject(typeof(Generated.Semantic.Traits.Enums.CellType), value);
                break;

            case nameof(Left):
                Left = (Unity.AI.Planner.Traits.TraitBasedObjectId)value;
                break;

            case nameof(Right):
                Right = (Unity.AI.Planner.Traits.TraitBasedObjectId)value;
                break;

            case nameof(Top):
                Top = (Unity.AI.Planner.Traits.TraitBasedObjectId)value;
                break;

            case nameof(Bottom):
                Bottom = (Unity.AI.Planner.Traits.TraitBasedObjectId)value;
                break;

            default:
                throw new ArgumentException($"Field \"{fieldName}\" does not exist on trait Cell.");
            }
        }
コード例 #2
0
        public void SetField(string fieldName, object value)
        {
            switch (fieldName)
            {
            case nameof(MoveCount):
                MoveCount = (System.Int32)value;
                break;

            case nameof(Score):
                Score = (System.Int32)value;
                break;

            case nameof(GoalType):
                GoalType = (Generated.Semantic.Traits.Enums.CellType)Enum.ToObject(typeof(Generated.Semantic.Traits.Enums.CellType), value);
                break;

            case nameof(GoalCount):
                GoalCount = (System.Int32)value;
                break;

            default:
                throw new ArgumentException($"Field \"{fieldName}\" does not exist on trait Game.");
            }
        }