예제 #1
0
 // Constructor(s)
 public Rock(Player player, Level level)
     : base()
 {
     this.Texture = TextureManager.rock;
     this.Position = new Vector2(Globals.Randomizer.Next(400, Globals.ScreenSize.X - 300), -100);
     this.Direction = (float)Math.Atan2((player.Position - Position).Y, (player.Position - Position).X);
     level.CombatText("|0,0,0|Rock heading |0,0,255|towards you!|255,0,0| Move!");
 }
예제 #2
0
 public void UnHide(Player player)
 {
     Hidden = false;
     Size = 1f;
     Type = player.TileChance[Globals.Randomizer.Next(0, player.TileChance.Count)];
     Texture = TextureManager.tiles[(int)Type];
     Position = new Vector2(Position.X, -100);
 }
예제 #3
0
파일: Item.cs 프로젝트: kraban/Outer-Space
 public static void Nothing(Player player, Item item)
 {
 }
예제 #4
0
파일: Item.cs 프로젝트: kraban/Outer-Space
 public static void HealPlayer(Player player, Item item)
 {
     if (player.Health.Value < player.Health.MaxValue)
     {
         player.Health.Change(player.Health.MaxValue * 0.15f);
         if (item.NumberOfItems > 1)
         {
             item.NumberOfItems--;
         }
         else
         {
             item.Dead = true;
         }
     }
 }
예제 #5
0
파일: Item.cs 프로젝트: kraban/Outer-Space
 public static void Flee(Player player, Item item)
 {
     if (SceneManager.CurrentScene == SceneManager.mapScene)
     {
         player.Move = true;
         if (item.NumberOfItems > 1)
         {
             item.NumberOfItems--;
         }
         else
         {
             item.Dead = true;
         }
     }
 }
예제 #6
0
파일: Level.cs 프로젝트: kraban/Outer-Space
        public void Initialize(Player player)
        {
            if (EnemyDifficulty != Difficulty.Boss)
            {
                SoundManager.ChangeMusic(SoundManager.combat);
            }
            else
            {
                SoundManager.ChangeMusic(SoundManager.boss);
            }
            Started = false;
            if (!Initialized)
            {
                GameObjects.Clear();
                GameObjects.Add(player);
                if (EnemyDifficulty != Difficulty.Boss)
                {
                    GameObjects.Add(new Enemy(EnemyDifficulty));
                }
                else
                {
                    GameObjects.Add(new Boss());
                }
                // Reward for defeating enemy
                for (int i = 0; i < Globals.Randomizer.Next(1, 3); i++)
                {
                    int random = Globals.Randomizer.Next(0, 3);
                    if (random == 0)
                    {
                        Rewards.Add(new Weapon(Player, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), (int)EnemyDifficulty));
                    }
                    else if (random == 1)
                    {
                        Rewards.Add(new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + (int)EnemyDifficulty * 20 + Globals.Randomizer.Next(-5, 15), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), (int)EnemyDifficulty));
                    }
                    if (random == 2)
                    {
                        Rewards.Add(new Hull(Player, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), (int)EnemyDifficulty));
                    }

                    // Consumable
                    if (Globals.Randomizer.Next(0, 101) < 55)
                    {
                        random = Globals.Randomizer.Next(0, 101);
                        if (random < 35)
                        {
                            Rewards.Add(new Item(Globals.Flee));
                        }
                        else
                        {
                            Rewards.Add(new Item(Globals.Heal));
                        }
                    }
                }
                InitializeTiles();
                Initialized = true;
            }
            else
            {
                GameObjects.RemoveAll(item => !(item is Enemy));
                GameObjects.Add(player);
            }
            Player.Position += new Vector2(0, 70);
            Player.ShipLocation = Location.middle;
            Player.MoveLeft = 0;
            Player.MoveRight = 0;
            player.ShipShield.Change(player.ShipShield.MaxValue);
            player.Energy.Change(1000);
            SceneManager.mapScene.KilledPlayer = (Enemy)GameObjects.First(item => item is Enemy);
        }