コード例 #1
0
 public override void EffectOfAoe(float Aoe, Enemies EnemOfInitialHit, List <Enemies> enemy, Bullet bullet)
 {
     EffectsManager.AddEarthSparksEffects(EnemOfInitialHit.CenterofSprite, EnemOfInitialHit.Direction);
     base.EffectOfAoe(Aoe, EnemOfInitialHit, enemy, bullet);
 }
コード例 #2
0
 public void OnHit(List <Enemies> listOfEnemies, Enemies enemCollidedWith)
 {
     AoeEffect.EffectOfAoe(Aoe, enemCollidedWith, listOfEnemies, this);
 }
コード例 #3
0
        //How A Left MouseClick is Handled.
        private void MouseClicked()
        {
            //Code To CheckIf We ClickedOnAnEnemy.
            foreach (Enemies enem in EnemiesInGame)
            {
                if (enem.CheckIfClicked(MouseWorldRect))
                {
                    NullifyEverything();
                    EnemySelected = enem;
                    if (!(EnemySelected.Type.ToString().Equals("Composite")))
                    {
                        GetEnemyElement();
                    }
                    EnemySelected.spriteAnimation.Shader = shader;
                    return;
                }
            }

            //Check if the SpinButtonIsClicked,
            if (spinButton.CheckIfClicked(MouseWorldRect))
            {
                SpinButtonClicked();
            }
            //If We are on the the Tower SelectionScreen.
            if (spinButton.isAnimation1)
            {
                //Check If any of the towers have been Clicked.
                foreach (Tower T in TowersInGame)
                {
                    if (T.CheckIfClicked(MouseWorldRect))
                    {
                        NullifyEverything();
                        CircleEffect = new DrawAble(new SpriteAnimation(CreateCircle((int)T.TowerRange)), T.Location, 0, 0);
                        Vector2 CricleEffectLocation = CircleEffect.Location;
                        CricleEffectLocation.X -= CircleEffect.spriteAnimation.CurrentAnimation.CurrentRect.Width / 2;
                        CricleEffectLocation.Y -= CircleEffect.spriteAnimation.CurrentAnimation.CurrentRect.Height / 2;
                        CricleEffectLocation.X += T.spriteAnimation.CurrentAnimation.CurrentRect.Width / 2;
                        CricleEffectLocation.Y += T.spriteAnimation.CurrentAnimation.CurrentRect.Height / 2;
                        CircleEffect.Location   = CricleEffectLocation;
                        CircleEffect.spriteAnimation.TintColor = Color.Red;
                        CurrentlySelected = T;
                        CurrentlySelected.spriteAnimation.Shader = shader;
                        CurrentlySelected.TurretAnim.Shader      = shader;
                        CreateSellButton();
                        DisplayNewButtons();
                        return;
                    }
                }
                //How To Handle A ButtonClick in TowerSection.
                foreach (Button b in ButtonsToDisplay)
                {
                    ButtonTower BT = b as ButtonTower; //We Know it is of the ButtonTower Kind.

                    if (b.CheckIfClicked(MouseWorldRect))
                    {
                        if (CurrentlySelected != null && CurrentlyClicked == null) //This Statement is True If We Want To update a tower.
                        {
                            Tower t = BT.Value;
                            if (CheckIfElementsRequirementMet(CurrentlySelected, t))
                            {
                                if (Gold >= BT.GoldToCreate)
                                {
                                    Game1.sound.playSound("OnTowerCreation");
                                    //if (r.Next(1, 9) < 4)
                                    //{
                                    //    Game1.sound.playSound("FoolishDecision");
                                    //}
                                    //else if (r.Next(1, 9) > 6)
                                    //{
                                    //    Game1.sound.playSound("SoYouThink");
                                    //}
                                    Gold -= BT.GoldToCreate;
                                    TowersInGame.Add(t.Copy(CurrentlySelected.Location, BT.GoldToCreate / 2));
                                    TowersInGame.Remove(CurrentlySelected);
                                    NullifyEverything();
                                    FlipFlopButtons();
                                }
                                else
                                {
                                    EffectsManager.NoGoldEffect();
                                }
                            }
                            else
                            {
                                EffectsManager.NotEnoughElements();
                            }
                        }
                        else // This Runs When We are making a base Tower
                        {
                            CurrentlyClicked = BT.Value;
                            TowerToDisplay   = CurrentlyClicked.Copy(BT.Location, BT.GoldToCreate / 2);
                        }
                        return;
                    }
                } // End Of Button Looping Code for Tower Panel.

                // This Runs When We have Clicked On a Button to Create a tower and we are not intersecting with the panel. It shows the red and green tower.
                if (CurrentlyClicked != null && !(PanelRec.Intersects(MouseScreenRect)))
                {
                    Vector2 TileAtClick = tilemap.GetCollTileAtPixel(new Vector2(MouseWorldRect.X, MouseWorldRect.Y));
                    if (tilemap.GetCollCellIndex(TileAtClick) == 1)
                    {
                        if (Gold >= DefaultTowerCost)
                        {
                            //This Code will Create A Default Tower if you have selected it.C:\Users\Arsinx\documents\visual studio 2010\Projects\EleTD\EleTD\EleTD\EffectsManager.cs
                            Gold -= DefaultTowerCost;
                            Game1.sound.playSound("OnTowerCreation");
                            //if (r.Next(1, 9) < 4)
                            //{
                            //    Game1.sound.playSound("FoolishDecision");
                            //}
                            //else if (r.Next(1, 9) > 6)
                            //{
                            //    Game1.sound.playSound("SoYouThink");
                            //}
                            TileAtClick *= 64;
                            TowersInGame.Add(CurrentlyClicked.Copy(TileAtClick, DefaultTowerCost));  // We are not Dividing the Tower Cost By 2 Because the basic tower has full Sell price.
                            tilemap.SetCollisionTile((int)TileAtClick.X, (int)TileAtClick.Y, 0);
                            CurrentlyClicked = null;
                            TowerToDisplay   = null;
                            return;
                        }
                        else
                        {
                            EffectsManager.NoGoldEffect();
                        }
                    }
                    else
                    {
                        EffectsManager.CantBuildEffect();
                        Game1.sound.playSound("CannotBuildTower");
                        return;
                    }
                } // End OF Selected Tower Display Code.

                //If We Click the Sell Button.
                if (CurrentlySelected != null)
                {
                    if (sellButton.CheckIfClicked(MouseWorldRect))
                    {
                        TowersInGame.Remove(sellButton.Value);
                        Game1.sound.playSound("OnTowerSell");
                        if (r.Next(1, 9) > 6)
                        {
                            Game1.sound.playSound("FoolishDecision");
                        }

                        EffectsManager.WritingEffect(sellButton.Value.CenterofSprite, sellButton.Value.SellPrice);
                        Gold += sellButton.Value.SellPrice;
                        NullifyEverything();
                        FlipFlopButtons();
                        return;
                    }
                } // End of Sell Code
            }
            else  //If Elements Screen is the main screen.
            {
                //How to handle elements if we are in the screen for Elements.
                foreach (Button b in ButtonsToDisplay)
                {
                    if (b.CheckIfClicked(MouseWorldRect))
                    {
                        ButtonElement BE = b as ButtonElement;
                        if (Materia > 0)
                        {
                            BoughtElementsList.Add(BE.Type);
                            Materia--;
                            return;
                        }
                        else
                        {
                            EffectsManager.NotEnoughMateria();
                        }
                    }
                }

                //TowerClick In Elements Section.
                foreach (Tower T in TowersInGame)
                {
                    if (T.CheckIfClicked(MouseWorldRect))
                    {
                        SpinButtonClicked();
                        CurrentlySelected = T;
                        CurrentlySelected.spriteAnimation.Shader = shader;
                        CurrentlySelected.TurretAnim.Shader      = shader;
                        CreateSellButton();
                        DisplayNewButtons();

                        return;
                    }
                }
            }
            NullifyEverything();
            FlipFlopButtons();
        }
コード例 #4
0
 public virtual void EffectOfAoe(float Aoe, Enemies EnemOfInitialHit, List <Enemies> enemy, Bullet bullet)
 {
     return;
 }