Ejemplo n.º 1
0
        private ShipTopology CreateDrone()
        {
            var topology = new ShipTopology(2, 2);

            topology.SetSection(new Point(0, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(0, 1), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, 1));
            topology.SetSection(new Point(1, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            return(topology);
        }
Ejemplo n.º 2
0
        //private (Point point, BuildNode buildNode) GetSelectedGridPoint()
        //{
        //}

        public void Tick(TickContext context)
        {
            var mouse     = Mouse.GetState();
            var screenPos = new Vector2(
                mouse.X / (float)GraphicsDevice.Viewport.Width,
                1.0f - (mouse.Y / (float)GraphicsDevice.Viewport.Height)
                ) * 2 - new Vector2(1, 1);
            //Console.WriteLine($"screen {screenPos}");

            //Console.WriteLine(screenPos);
            //Console.WriteLine(worldDirectionVector);
            var ray = Camera.CreateRay(screenPos);
            var res = RayCollider.RayCast(ray, (byte)HitLayers.BuildTile);
            // Console.WriteLine($"Location: {res.location}");

            var buildNode = res.entity?.Get <BuildNode>();

            if (buildNode != null)
            {
                //Console.WriteLine($"{buildNode.GridLocation}");
            }
            this.Update(() => HoverNode = buildNode);

            if (PlacingSection != null)
            {
                if (KeyControls.HasBeenPressed(Keys.R))
                {
                    PlacingSection.Rotate(1);
                }
                if (MouseControls.RightClicked)
                {
                    CancelPlacing();
                }
                else if (buildNode != null && MouseControls.LeftClicked)
                {
                    var gridLocation = buildNode.GridLocation;
                    if (_shipTopology.SectionAt(gridLocation) == null &&
                        _shipTopology.LegalSectionCheck(PlacingSection, gridLocation))
                    {
                        this.Update(() =>
                        {
                            _shipTopology.SetSection(gridLocation, PlacingSection);
                            _productionLine.Remove(PlacingSection);
                            PlacingSection = null;
                            SoundEffects.Get("Hammer")?.Play();
                        });
                    }
                    else
                    {
                        SoundEffects.Get("Click")?.Play();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void ClickFlight(ClickUIEvent ev)
        {
            var keys = Keyboard.GetState();

            if (!keys.IsKeyDown(Keys.LeftControl))
            {
                _fadeTransition.StartTransition(() =>
                {
                    _sceneManager.SetScene(new CreditsScene());
                });
                return;
            }

            var topology = new ShipTopology(6, 5);

            if (keys.IsKeyDown(Keys.D9))
            {
                for (var i = 0; i < 6; i++)
                {
                    for (var j = 0; j < 5; j++)
                    {
                        topology.SetSection(new Point(i, j), new Section(
                                                new RocketModule(),
                                                ConnectionLayouts.FullyConnected,
                                                1
                                                ));
                    }
                }
            }

            topology.SetSection(new Point(2, 2), new Section(
                                    new ResearchCenterModule(),
                                    ConnectionLayouts.FullyConnected
                                    ));
            topology.SetSection(new Point(2, 1), new Section(
                                    new BlasterModule(),
                                    ConnectionLayouts.FullyConnected,
                                    4
                                    ));
            topology.SetSection(new Point(3, 1), new Section(
                                    new BombardModule(),
                                    ConnectionLayouts.FullyConnected,
                                    4
                                    ));
            topology.SetSection(new Point(2, 3), new Section(
                                    new RocketModule(),
                                    ConnectionLayouts.FullyConnected,
                                    1
                                    ));
            topology.SetSection(new Point(1, 3), new Section(
                                    new RocketModule(),
                                    ConnectionLayouts.FullyConnected,
                                    2
                                    ));
            topology.SetSection(new Point(3, 3), new Section(
                                    new RocketModule(),
                                    ConnectionLayouts.FullyConnected,
                                    OffDirection.SouthEast
                                    ));
            topology.SetSection(new Point(3, 2), new Section(
                                    new RotaryEngine(),
                                    ConnectionLayouts.FullyConnected,
                                    1
                                    ));
            topology.SetSection(new Point(4, 2), new Section(
                                    new RotaryEngine(),
                                    ConnectionLayouts.FullyConnected,
                                    1
                                    ));
            topology.SetSection(new Point(5, 2), new Section(
                                    new RotaryEngine(),
                                    ConnectionLayouts.FullyConnected,
                                    1
                                    ));
            topology.ApplyUpgrade(new RapidFire());
            var orchestrator = _menuScene.Create(false).Add(new Orchestrator(topology));

            orchestrator.CurrentPlanet = Planet.Earth;
            orchestrator.NextFlight();

            //_menuScene.SetScene(new FlightScene(topology));
        }
Ejemplo n.º 4
0
        private ShipTopology CreateBandit()
        {
            var topology = new ShipTopology(4, 4);

            for (var i = 0; i < 4; i++)
            {
                for (var j = 0; j < 4; j++)
                {
                    topology.SetSection(new Point(i, j), new Section(new EmptyModule(), ConnectionLayouts.FullyConnected, 4));
                }
            }
            topology.SetSection(new Point(0, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(1, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(2, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(3, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 6));
            topology.SetSection(new Point(0, 3), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, 0));
            topology.SetSection(new Point(1, 3), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, 1));
            topology.SetSection(new Point(2, 3), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, 1));
            topology.SetSection(new Point(3, 3), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, 2));

            topology.SetSection(new Point(1, 2), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(2, 2), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            return(topology);
        }
Ejemplo n.º 5
0
        private ShipTopology CreateWall(int wallWave)
        {
            var topology = new ShipTopology(14, 3);

            for (var i = 0; i < 14; i++)
            {
                for (var j = 0; j < 3; j++)
                {
                    if (j == 2)
                    {
                        topology.SetSection(new Point(i, j), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, i == 0 ? 0 : i == 13 ? 2 : 1));
                    }
                    else if (j == 1 && i > 0 && i < 13)
                    {
                        topology.SetSection(new Point(i, j), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, i == 0 ? 0 : i == 3 ? 2 : 1));
                    }
                    else
                    {
                        topology.SetSection(new Point(i, j), new Section(_armoured ? new ArmourModule() as Module : new EmptyModule(), ConnectionLayouts.FullyConnected, 4));
                    }
                }
            }

            if (wallWave == 1)
            {
                topology.SetSection(new Point(6, 1), new Section(new EmptyModule(), ConnectionLayouts.FullyConnected, 0));
            }
            if (wallWave == 2)
            {
                topology.SetSection(new Point(4, 1), new Section(new EmptyModule(), ConnectionLayouts.FullyConnected, 0));
                topology.SetSection(new Point(8, 1), new Section(new EmptyModule(), ConnectionLayouts.FullyConnected, 0));
            }

            topology.SetSection(new Point(1, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(3, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(5, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(7, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(9, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(11, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(13, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            return(topology);
        }
Ejemplo n.º 6
0
        private ShipTopology CreateWall(int wallWave)
        {
            var topology = new ShipTopology(10, 10);

            for (var i = 0; i < 10; i++)
            {
                for (var j = 0; j < 10; j++)
                {
                    if (j == 9)
                    {
                        topology.SetSection(new Point(i, j), new Section(new RocketModule(), ConnectionLayouts.FullyConnected, i == 0 ? 0 : i == 9 ? 2 : 1));
                    }
                    else
                    {
                        topology.SetSection(new Point(i, j), new Section(new ArmourModule(), ConnectionLayouts.FullyConnected, 4));
                    }
                }
            }


            topology.SetSection(new Point(0, 0), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 4), new Section(new ResearchCenterModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(3, 4), new Section(new ResearchCenterModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 5), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(6, 7), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(8, 5), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(3, 4), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(2, 2), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(2, 3), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(2, 5), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(2, 6), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(2, 8), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(8, 2), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(8, 5), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(8, 8), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 2), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 3), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 5), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 6), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(4, 8), new Section(new EnergyModule(), ConnectionLayouts.FullyConnected, 2));


            topology.SetSection(new Point(1, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(2, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(3, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(4, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(5, 0), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(6, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(7, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(8, 0), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(9, 0), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 4));

            topology.SetSection(new Point(0, 1), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(0, 2), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(0, 3), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(0, 4), new Section(new ShieldBubbleGeneratorModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(0, 5), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 2));
            topology.SetSection(new Point(0, 6), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(0, 7), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(0, 8), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 3));
            topology.SetSection(new Point(0, 9), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 3));

            topology.SetSection(new Point(9, 1), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(9, 2), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(9, 3), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(9, 4), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 0));
            topology.SetSection(new Point(9, 5), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(9, 6), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 4));
            topology.SetSection(new Point(9, 7), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 5));
            topology.SetSection(new Point(9, 8), new Section(new BombardModule(), ConnectionLayouts.FullyConnected, 0));
            topology.SetSection(new Point(9, 9), new Section(new BlasterModule(), ConnectionLayouts.FullyConnected, 5));
            topology.ApplyUpgrade(new BlastRocketry());
            // topology.ApplyUpgrade(new BombardOverload());
            topology.ApplyUpgrade(new ShieldAmplification());
            topology.ApplyUpgrade(new ShieldFortification());

            return(topology);
        }
Ejemplo n.º 7
0
 public Orchestrator(ShipTopology shipTopology = null)
 {
     _shipTopology = shipTopology;
     if (_shipTopology == null)
     {
         _shipTopology = new ShipTopology(6, 5);
         _shipTopology.SetSection(new Point(2, 2), new Section(
                                      new ResearchCenterModule(),
                                      ConnectionLayouts.FullyConnected
                                      ));
     }
     AddPlanet(
         Planet.Earth,
         () => new AsteroidPhase(10, AsteroidDistributions.StandardAsteroidDistribution),
         () => new OutOfBoundsPhase(),
         () => new TransmissionPhase(),
         () => new BanditPhase(0),
         () => new SatellitePhase(Planet.Mars)
         );
     AddPlanet(
         Planet.Mars,
         () => new AsteroidPhase(20, AsteroidDistributions.StandardAsteroidDistribution),
         () => new DroneStrikePhase(3),
         () => new TransmissionPhase(),
         () => new StormWallBossPhase(false),
         () => new SatellitePhase(Planet.Jupiter)
         );
     AddPlanet(
         Planet.Jupiter,
         () => new IceAsteroidPhase(20, AsteroidDistributions.IceAsteroidDistribution),
         () => new BanditPhase(1),
         () => new TransmissionPhase(),
         () => new AsteroidPhase(30, AsteroidDistributions.StandardAsteroidDistribution),
         () => new SatellitePhase(Planet.Saturn)
         );
     AddPlanet(
         Planet.Saturn,
         () => new IceAsteroidPhase(40, AsteroidDistributions.IceAsteroidDistribution),
         () => new TransmissionPhase(),
         () => new BanditPhase(2),
         () => new AsteroidPhase(50, AsteroidDistributions.StandardAsteroidDistribution),
         () => new StormWallBossPhase(true),
         () => new SatellitePhase(Planet.Uranus)
         );
     AddPlanet(
         Planet.Uranus,
         () => new IceAsteroidPhase(60, AsteroidDistributions.IceAsteroidDistribution),
         () => new TransmissionPhase(),
         () => new DroneStrikePhase(5),
         () => new AsteroidPhase(70, AsteroidDistributions.StandardAsteroidDistribution),
         () => new SatellitePhase(Planet.Neptune)
         );
     AddPlanet(
         Planet.Neptune,
         () => new IceAsteroidPhase(90, AsteroidDistributions.IceAsteroidDistribution),
         () => new TransmissionPhase(),
         () => new DroneStrikePhase(6),
         () => new AsteroidPhase(100, AsteroidDistributions.StandardAsteroidDistribution),
         () => new GalactusBossPhase(),
         () => new AsteroidPhase(100, AsteroidDistributions.StandardAsteroidDistribution)
         );
 }