예제 #1
0
        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.");
            }
        }