/// <summary> /// Creates all of the games formation objects with ship /// pre-defined positions based on the number of ships to be used. /// </summary> /// <param name="numShips">The number of ships that will be used within the formations.</param> /// <param name="shipWidth">The width of the ship that will be used in spacing the ships.</param> /// <param name="shipHeight">The height of the ship that will be used in spacing the ships.</param> public FormationManager(Game game, int numShips, int shipWidth, int shipHeight, PlayerIndex playerIndex) { this.game = game; this.currentPlayerIndex = playerIndex; currentNumberOfShips = numShips; globalFixedPoint = Vector2.Zero; drawFixedPoint = false; //Initialize the global fixed point to the bottom middle of the screen. globalRotation = 0; /* Initialize the different formations (positions, rotations, and bounding rectangles) */ formationList = new Dictionary <Defines.GESTURES, Formation>(); //TODO: Stop using the formation variables and just populate the formation list. formationList.Add(Defines.GESTURES.NORMAL, new NormalFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.SQUARE, new SquareFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.V, new VFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.LINE, new LineFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.TRIANGLE, new TriangleFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.RESET, formationList[Defines.GESTURES.NORMAL]); fusionFormationList = new Dictionary <Defines.GESTURES, FusionFormation>(); fusionFormationList.Add(Defines.GESTURES.LINE_FUSION, new CrossFusionFormation(game, shipWidth, shipHeight, globalFixedPoint)); //Set current formation to the default Normal Formation. currentFormation = formationList[Defines.GESTURES.NORMAL]; gestureComponent = new GestureComponent(playerIndex); }
/// <summary> /// Creates all of the games formation objects with ship /// pre-defined positions based on the number of ships to be used. /// </summary> /// <param name="numShips">The number of ships that will be used within the formations.</param> /// <param name="shipWidth">The width of the ship that will be used in spacing the ships.</param> /// <param name="shipHeight">The height of the ship that will be used in spacing the ships.</param> public FormationManager(Game game, int numShips, int shipWidth, int shipHeight, PlayerIndex playerIndex) { this.game = game; this.currentPlayerIndex = playerIndex; currentNumberOfShips = numShips; globalFixedPoint = Vector2.Zero; drawFixedPoint = false; //Initialize the global fixed point to the bottom middle of the screen. globalRotation = 0; /* Initialize the different formations (positions, rotations, and bounding rectangles) */ formationList = new Dictionary<Defines.GESTURES,Formation>(); //TODO: Stop using the formation variables and just populate the formation list. formationList.Add(Defines.GESTURES.NORMAL, new NormalFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.SQUARE, new SquareFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.V, new VFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.LINE, new LineFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.TRIANGLE, new TriangleFormation(numShips, shipWidth, shipHeight, globalFixedPoint)); formationList.Add(Defines.GESTURES.RESET, formationList[Defines.GESTURES.NORMAL]); fusionFormationList = new Dictionary<Defines.GESTURES, FusionFormation>(); fusionFormationList.Add(Defines.GESTURES.LINE_FUSION, new CrossFusionFormation(game, shipWidth, shipHeight, globalFixedPoint)); //Set current formation to the default Normal Formation. currentFormation = formationList[Defines.GESTURES.NORMAL]; gestureComponent = new GestureComponent(playerIndex); }