//--------------------------------------------------------------- //SHIP ON MAP ON CLICK //--------------------------------------------------------------- private bool ShipOnMapClick(ShipOnMap sender, MouseState ms) { return IsHigher(sender.ToIDraw(), ms); }
//--------------------------------------------------------------- //SHIP SYSTEM ENTER //--------------------------------------------------------------- private void ShipSystemEnter(ShipOnMap sender, IMoveble target) { //Заставлять его нормально считать координаты. //И устанавливать IsMoving в фалс. foreach (Ship ship in sender.Ships) { target.ToStarOnMap().SS.Objects.Add(ship); } sender.OnSystemEnter -= ShipSystemEnter; sender.OnRightButtonClick -= ShipOnMapRightButtonClick; screens["GalaxyMap"].Objects["Map"].ToMap().Objects.Remove(sender); }
//--------------------------------------------------------------- //SHIP SYSTEM QUIT //--------------------------------------------------------------- private void ShipSystemQuit(Ship sender) { Texture2D texture = Content.Load<Texture2D>("LittleStars/ShipOnMap"); Texture2D circle = Content.Load<Texture2D>("LittleStars/CurrentPlayerCircle"); StarOnMap SOM = FindStarOnMapWithThisObject(sender); List<Ship> ships = new List<Ship>(); ships.Add(sender); Vector2 position = new Vector2(SOM.Position.X + SOM.Width + 5, SOM.Position.Y + SOM.Height + 5); ShipOnMap temp = new ShipOnMap(texture, circle, position, new Vector2(Scales.FourTenth), ships); sender.OnClick -= ShipOnClick; sender.OnRightButtonClick -= ShipRightButtonClick; sender.OnSystemQuit -= ShipSystemQuit; screens["GalaxyMap"].Objects["Map"].ToMap().Objects.Add(temp.ToIDraw()); screens["SolarSystem"].Objects["SolarSystem"].ToSolarSystem().Objects.Remove(sender.ToIDraw()); //screens["SolarSystem"].Objects["SolarSystem"].ToSolarSystem().Objects = screens["SolarSystem"].Objects["SolarSystem"].ToSolarSystem().Objects.ToList<IDraw>(); }
//--------------------------------------------------------------- //SHIP ON MAP RIGHT BUTTON CLICK //--------------------------------------------------------------- private IMoveble ShipOnMapRightButtonClick(ShipOnMap sender, MouseState ms) { return FindObjectUnderCursor(ms); }