public static ICelestialObject GenerateNpcShip(GameSession gameSession, int spaceShipClass, int spaceShipType, int standing) { var spaceship = gameSession.GetPlayerSpaceShip().ToSpaceship(); Spaceship newCelestialObject = null; switch (spaceShipType) { case 12: newCelestialObject = Fury.Generate(); break; default: break; } if (newCelestialObject != null) { newCelestialObject.PositionX = spaceship.PositionX + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.PositionY = spaceship.PositionY + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.Speed = newCelestialObject.MaxSpeed; newCelestialObject.Direction = GeometryTools.Azimuth(spaceship.GetLocation(), newCelestialObject.GetLocation()); } return(newCelestialObject); }
public static ICelestialObject GenerateNpcShip(GameSession gameSession, int spaceShipClass, int spaceShipType, int standing) { Logger.Debug($"[CelestialObjectsFactory][GenerateNpcShip] Start generate."); var spaceship = gameSession.GetPlayerSpaceShip().ToSpaceship(); Spaceship newCelestialObject = null; switch (spaceShipType) { case 12: newCelestialObject = Fury.Generate(); break; default: break; } if (newCelestialObject != null) { newCelestialObject.PositionX = spaceship.PositionX + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.PositionY = spaceship.PositionY + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.Speed = newCelestialObject.MaxSpeed; newCelestialObject.Direction = SpaceMapTools.GetAngleBetweenPoints(newCelestialObject.GetLocation().ToVector2(), spaceship.GetLocation().ToVector2()); } return(newCelestialObject); }