/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }
private static bool IsEnemy(Building _building, Game1 _game) { return _building.player == _game.enemy; }
public static Object WhatClicked(Game1 game, Ray clippedRay) { bool selected = false; foreach (Unit unit in game.player.UnitList) { selected = Collisions.RayModelCollision(clippedRay, unit.currentModel.Model, unit.GetWorldMatrix()); if (selected) return unit; } foreach (Building building in game.player.BuildingList) { selected = Collisions.RayModelCollision(clippedRay, building.currentModel.Model, building.GetWorldMatrix()); if (selected) return building; } foreach (Unit unit in game.enemy.UnitList) { selected = Collisions.RayModelCollision(clippedRay, unit.currentModel.Model, unit.GetWorldMatrix()); if (selected) return unit; } foreach (Building building in game.enemy.BuildingList) { selected = Collisions.RayModelCollision(clippedRay, building.currentModel.Model, building.GetWorldMatrix()); if (selected) return building; } foreach (Decoration decoration in game.decorations.DecorationList) { selected = Collisions.RayModelCollision(clippedRay, decoration.currentModel.Model, decoration.GetWorldMatrix()); if (selected) return decoration; } return 0; }
private static bool IsEnemy(Unit _unit, Game1 _game) { return _unit.player == _game.enemy; }
public static void ProcessInput(Game1 game) { if (Input.currentMouseState.LeftButton == ButtonState.Pressed) { if (Input.currentMouseState.X < Minimap.width + Minimap.diff && Input.currentMouseState.Y < Minimap.height + Minimap.diff) { Camera.cameraPosition.X = Input.currentMouseState.X * 5; Camera.cameraPosition.Z = Input.currentMouseState.Y * 5 + 75; } } if (Input.oldMouseState.LeftButton == ButtonState.Pressed && Input.currentMouseState.LeftButton == ButtonState.Released) { if (insideRectangle(LowerOptionPanel.firstTabPosition) && UnitBackground.whichUnit == 0 && LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 1, 0, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.secondTabPosition) && UnitBackground.whichUnit == 0 && LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 2, 0, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.thirdTabPosition) && UnitBackground.whichUnit == 0 && LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 3, 0, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.fourthTabPosition) && UnitBackground.whichUnit == 0 && LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 4, 0, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.firstTabPosition) && UnitBackground.whichUnit == 1 && !LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 1, 1, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.secondTabPosition) && UnitBackground.whichUnit == 1 && !LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 2, 1, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.thirdTabPosition) && UnitBackground.whichUnit == 1 && !LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 3, 1, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.firstTabPosition) && UnitBackground.whichUnit == 2 && !LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 1, 2, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } else if (insideRectangle(LowerOptionPanel.secondTabPosition) && UnitBackground.whichUnit == 2 && !LowerOptionPanel.isUnit) { GUIEventManager.CreateMessage(new Message((int)GUIEventManager.Events.GuiCLICK, 2, 2, game)); //1 to nadawca czyli 1 button , 0 to odbiorca czyli kto ma wykonac : 0 to dron } } }