Ejemplo n.º 1
0
 private void targettingStrategyButton_Click(Button button)
 {
     if (button != null)
     {
         var strategyButton = button.Content as TargetingStrategyButton;
         if (strategyButton != null)
         {
             var actor = strategyButton.Actor;
             actor.TargettingStrategy = strategyButton.TargetingStrategy.Value;
         }
     }
 }
Ejemplo n.º 2
0
 private void pauseButton_Click(Button pauseButton)
 {
     isPaused = !isPaused;
     pauseButton.Content = isPaused ? "Unpause" : "Pause";
 }
Ejemplo n.º 3
0
        private void abilityButton_Click(Button button)
        {
            if (button != null)
            {
                var abilityButton = button.Content as AbilityButton;
                if (abilityButton != null)
                {
                    var ability = abilityButton.Ability;
                    var actor = abilityButton.Actor;

                    if (ability.TargettingType == TargettingTypes.Self)
                        IssueOrder(actor, new Order(ability, actor, actor));
                    else
                        isTargetting = abilityButton;
                }
            }
        }
Ejemplo n.º 4
0
 private void orderQueueButton_Click(Button button)
 {
     if (button != null)
     {
         var abilityButton = button.Content as OrderButton;
         if (abilityButton != null)
         {
             var order = abilityButton.Order;
             abilityButton.Actor.Orders.Remove(order);
         }
     }
 }
Ejemplo n.º 5
0
        public override void LoadContent()
        {
            kootenayFont = ContentManager.Load<SpriteFont>(@"Fonts\Kootenay");
            kootenaySmallFont = ContentManager.Load<SpriteFont>(@"Fonts\KootenaySmall");

            scene = new Scene(ScreenManager.GraphicsDevice);
            scene.LoadContent(ContentManager);
            scene.Nodes.Add(new Level(ScreenManager.GraphicsDevice, ContentManager.Load<Model>(@"Models\Levels\pillarlevel")));
            scene.Nodes.Add(new ParticleSystem(ScreenManager.GraphicsDevice, ContentManager.Load<Effect>(@"Shaders\Particle"))
            {
                BlendState = BlendState.NonPremultiplied,
                Texture = ContentManager.Load<Texture2D>(@"Sprites\fog"),
                RotationSpeed = 0.2f,
                SpawnRate = 0,
                MaxParticles = 200,
                Emitter = () => new Particle()
                {
                    Position = random.NextVector3(-40, 40) - new Vector3(0, 2, 0),
                    Alpha = random.Between(0.1f, 0.16f),
                    Scale = random.Between(15f, 18f),
                    Angle = random.Between(0f, 6f),
                    LifeSpan = float.PositiveInfinity
                },
            });
            scrollingTextSystem = new ScrollingTextSystem(scene, SpriteBatch, kootenaySmallFont, kootenayFont);
            scene.Nodes.Add(scrollingTextSystem);

            // TODO: This is map specific
            AddFire(new Vector3(-10.5f, 0.5f, -10.5f));
            AddFire(new Vector3(10.5f, 0.5f, -10.5f));
            AddFire(new Vector3(10.5f, 0.5f, 10.5f));
            AddFire(new Vector3(-10.5f, 0.5f, 10.5f));

            healthBarTexture = ContentManager.Load<Texture2D>(@"Interface\healthbar");
            defaultAbilityTexture = ContentManager.Load<Texture2D>(@"Icons\INV_Misc_QuestionMark");

            var buttonTexture = ContentManager.Load<Texture2D>(@"Interface\button3");
            var buttonMouseOverTexture = ContentManager.Load<Texture2D>(@"Interface\button3-mouseover");

            var pauseButton = new Button
            {
                Content = "Unpause",
                Position = new Vector2(ActualWidth / 2 - 220, 4),
                Background = new Color(230, 140, 60),
                BackgroundTexture = buttonTexture,
                MouseOverTexture = buttonMouseOverTexture,
                Width = 200,
                Height = 60,
                ZIndex = 0.1f,
            };
            pauseButton.Click += () => pauseButton_Click(pauseButton);
            Controls.Add(pauseButton);

            var benchButton = new Button
            {
                Content = "Benchmark",
                Position = new Vector2(ActualWidth / 2 + 20, 4),
                Background = new Color(230, 140, 60),
                BackgroundTexture = buttonTexture,
                MouseOverTexture = buttonMouseOverTexture,
                Width = 200,
                Height = 60,
                ZIndex = 0.1f,
            };
            benchButton.Click += () => isBenchmarking = !isBenchmarking;
            //Controls.Add(benchButton);

            var priorityQueueButton = new Button
            {
                Content = "Priority",
                Position = new Vector2(ActualWidth / 4 - 20, ActualHeight - 85),
                Background = new Color(230, 140, 60),
                BackgroundTexture = buttonTexture,
                MouseOverTexture = buttonMouseOverTexture,
                Width = 200,
                Height = 60,
                ZIndex = 0.1f,
            };
            priorityQueueButton.Click += priorityButton_Click;
            Controls.Add(priorityQueueButton);

            for (int i = 0; i < 10; i++)
            {
                var abilityButton = new Button();
                abilityButton.Position = new Vector2((ActualWidth / 2) - 300 + i * 40, ActualHeight - 80);
                abilityButton.Width = 32;
                abilityButton.Height = 32;
                abilityButton.Background = Color.Transparent;
                abilityButton.Click += () => abilityButton_Click(abilityButton);
                abilityButtons.Add(abilityButton);
                Controls.Add(abilityButton);
            }

            for (int i = 0; i < 10; i++)
            {
                var orderQueueButton = new Button();
                orderQueueButton.Position = new Vector2((ActualWidth / 2) - 300 + i * 65, ActualHeight - 125);
                orderQueueButton.Width = 32;
                orderQueueButton.Height = 32;
                orderQueueButton.Background = Color.Transparent;
                orderQueueButton.Click += () => orderQueueButton_Click(orderQueueButton);
                orderQueueButtons.Add(orderQueueButton);
                Controls.Add(orderQueueButton);
            }

            //for (int i = 0; i < player.UnlockedTargetingStrategies.Count; i++)
            //{
            //    var targettingStrategyButton = new Button();
            //    targettingStrategyButton.Position = new Vector2((Width / 2) + 300 + i * 40, Height - 80);
            //    targettingStrategyButton.Width = 32;
            //    targettingStrategyButton.Height = 32;
            //    targettingStrategyButton.Background = Color.TransparentBlack;
            //    targettingStrategyButton.Click += () => targettingStrategyButton_Click(targettingStrategyButton);
            //    targettingStrategyButtons.Add(targettingStrategyButton);
            //    Controls.Add(targettingStrategyButton);
            //}

            base.LoadContent();
        }