コード例 #1
0
        public void OnButtonRelease(object sender, MouseButtonEventArgs e)
        {
            if (CurrentTower!=null)
            {
                CurrentTower.Selected = false;
                CurrentTower.Activated = true;

                try
                {
                    CurrentTower.sprite.Position = Level.GetValidPosition(CurrentTower.Position + new Vec2f((CurrentTower.sprite.Texture.Size.X * CurrentTower.sprite.Scale.X) / 2,
                        (CurrentTower.sprite.Texture.Size.Y * CurrentTower.sprite.Scale.Y) / 2));
                }
                catch (PathException)
                {
                    Money += CurrentTower.Costs;
                    CurrentTower.IsAlive = false;
                }

                CurrentTower = null;
            }
        }
コード例 #2
0
        public void OnButtonPress(object sender, MouseButtonEventArgs e)
        {
            if (MouseControler.MouseIn(testTower.sprite) && Money >= testTower.Costs)
            {
                new TestTower();
                TowerHandler.Towers[TowerHandler.Towers.Count - 1].Selected = true;
                Money -= testTower.Costs;
                CurrentTower = TowerHandler.Towers[TowerHandler.Towers.Count - 1];
            }

            if (MouseControler.MouseIn(schafGroßTower.sprite) && Money >= schafGroßTower.Costs)
            {
                new SchafGroßTower();
                TowerHandler.Towers[TowerHandler.Towers.Count - 1].Selected = true;
                Money -= schafGroßTower.Costs;
                CurrentTower = TowerHandler.Towers[TowerHandler.Towers.Count - 1];
            }

            if (MouseControler.MouseIn(rainbowTower.sprite) && Money >= rainbowTower.Costs)
            {
                new RainbowSheep();
                TowerHandler.Towers[TowerHandler.Towers.Count - 1].Selected = true;
                Money -= rainbowTower.Costs;
                CurrentTower = TowerHandler.Towers[TowerHandler.Towers.Count - 1];
            }

            if (MouseControler.MouseIn(sniperTower.sprite) && Money >= sniperTower.Costs)
            {
                new SheepSniper();
                TowerHandler.Towers[TowerHandler.Towers.Count - 1].Selected = true;
                Money -= sniperTower.Costs;
                CurrentTower = TowerHandler.Towers[TowerHandler.Towers.Count - 1];
            }

            if (MouseControler.MouseIn(chainsawSheep.sprite) && Money >= chainsawSheep.Costs)
            {
                new ChainsawSheep();
                TowerHandler.Towers[TowerHandler.Towers.Count - 1].Selected = true;
                Money -= chainsawSheep.Costs;
                CurrentTower = TowerHandler.Towers[TowerHandler.Towers.Count - 1];
            }
        }
コード例 #3
0
 public void OnButtonPress(object sender, MouseButtonEventArgs e)
 {
     RemoveControls();
     ReturnState = EGameStates.MainMenu;
 }
コード例 #4
0
 public void OnButtonRelease(object sender, MouseButtonEventArgs e)
 {
 }
コード例 #5
0
        public void OnButtonPress(object sender, MouseButtonEventArgs e)
        {
            if(Selected == ESelectedSprite.Exit)
            {
                RemoveControls();

                ReturnState = EGameStates.None;
            }

            if(Selected == ESelectedSprite.Start)
            {
                RemoveControls();

                ReturnState = EGameStates.InGame;
            }
        }