public override void Start() { Ship = Entity.EntityManager.GetAll <FlightShip>().First(); _camera = Entity.EntityManager.GetAll <FlightCameraControl>().First(); _oldCameraScale = _camera.CameraScale; _camera.CameraScale = 5f; var random = new Random(); var takenUpgrades = Ship.Upgrades.ToArray(); var possible = PotentialUpgrades .Where(x => takenUpgrades.All(y => y.GetType() != x.GetType())) .Select(x => (x, random.Next(1000))) .ToList() as List <(UpgradeBase, int)>; possible .Sort((x, y) => x.Item2 - y.Item2); var candidates = possible.Select(x => x.Item1) .ToArray(); if (candidates.Length < 3) { candidates = PotentialUpgrades; } _dispose = UserInterfaceManager.Create(new UpgradeMenu( new List <UpgradeBase>() { candidates[0], candidates[1], candidates[2] }, OnSelect )); }
public override void Initialise() { _uiCleanup = UserInterfaceManager.Create(new SplashTemplate("Welcome to Forge", SceneManager)); Fonts.Load("Default", Content.Load <SpriteFont>("Font/Default")); Textures.Load("Rocket", Content.Load <Texture2D>("Icon/Rocket")); Textures.Load("Settings", Content.Load <Texture2D>("Icon/Settings")); Textures.Load("Globe", Content.Load <Texture2D>("Icon/Globe")); }
public override void Initialise() { AddSingleton(new SpaceBackgroundScroll()); var focusLocation = HexagonHelpers.GetGridWorldPosition(new Point(2, 2)); var camera = Create(); var cameraPos = camera.Add(new Transform() { Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, (float)(Math.PI)), Location = focusLocation + (Vector3.Backward + Vector3.Up * 1.8f) * 10 }); //CameraManager.ActiveCamera = camera.Add(new Camera(new OrthographicCameraParameters(10))); CameraManager.ActiveCamera = camera.Add(new Camera(new PerspectiveCameraParameters() { AspectRatio = GraphicsDevice.Viewport.AspectRatio })); CameraManager.ActiveCamera.LookAt(focusLocation); CameraManager.ActiveCamera.Recalculate(); camera.Add(new BuildCameraControl()); // Background planet. var planetEnt = Create(); planetEnt.Add(new Transform() { Location = cameraPos.Location + CameraManager.ActiveCamera.Forwards * 100 + Vector3.Forward * 50 }); var planetRenderer = planetEnt.Add(new PlanetRenderer() { AutoRender = true, Planet = _planet, Scale = 80f, RenderOrder = 20 }); var floor = Create(); floor.Add(new BuildFloor(_shipTopology)); var productionLine = AddSingleton(new ProductionLine()); var gameMode = AddSingleton(new BuildMode(_shipTopology, _planet)); var placerEnt = Create(); var placer = placerEnt.Add(new BuildPlacer(CameraManager.ActiveCamera, _shipTopology, productionLine)); placerEnt.Add(new BuildPlacerCursor()); var shipRenderer = AddSingleton(new ShipSectionRenderer()); UserInterfaceManager.AddSceneUI(this, new BuildScreenTemplate(gameMode, _planet, productionLine, placer, shipRenderer)); if (_planet == Planet.Earth) { UIDispose closeBeginScreen = null; closeBeginScreen = UserInterfaceManager.Create(new BeginScreenTemplate(() => { gameMode.Start(); EntityManager.Update(() => { closeBeginScreen?.Invoke(); }); })); } else { gameMode.Start(); } MusicManager.Start("Building"); }
public void Initialise() { UserInterfaceManager.Create(new DragOverlayTemplate(this), 200); }