public Strategy(Size size,
                 BuildingShape shape,
                 Converter <GridCoordinate, Vector3> convertToGameObjectPosition,
                 Converter <Vector3, GridCoordinate> convertToGridCoordinate)
 {
     Size  = size;
     Shape = shape;
     _convertToGameObjectPosition = convertToGameObjectPosition;
     _convertToGridCoordinate     = convertToGridCoordinate;
 }
        /// <summary> Retrieves a IObjectShapeStrategy for a given ObjectShape. </summary>
        /// <exception cref="ArgumentOutOfRangeException"> Thrown when one or more arguments are outside
        ///  the required range. </exception>
        /// <param name="shape"> The shape for which a IObjectShapeStrategy should be retrieved. </param>
        /// <returns> The strategy for the given ObjectShape. </returns>
        public static IBuildingShapeStrategy GetStrategyFor(BuildingShape shape)
        {
            switch (shape)
            {
            case BuildingShape.SquareUnit:
                return(SquareUnitStrategy);

            case BuildingShape.TwoByTwo:
                return(TwoByTwoStrategy);

            default:
                throw new ArgumentOutOfRangeException("shape");
            }
        }
예제 #3
0
 public Project(ProjectDifficulty difficulty, string name, BuildingShape building)
 {
     Difficulty = difficulty;
     Name       = name;
     Building   = building;
 }