예제 #1
0
파일: LastBoss.cs 프로젝트: sinshu/dtf
        public override void Update()
        {
            damaged = false;

            if (isDying)
            {
                if (dyingCount < 60)
                {
                    if (dyingCount % 2 == 0)
                    {
                        Effect effect = new SmallExplosionEffect(Game, X + Game.Random.Next(-32, 32 + 1), Y + Game.Random.Next(-32, 32 + -+1), Game.Random.Next(0, 360));
                        Game.AddEffect(effect);
                        if (dyingCount % 4 == 0)
                        {
                            Game.PlaySound(Sound.Explosion);
                        }
                    }
                    dyingCount++;
                    if (dyingCount == 60)
                    {
                        Effect effect = new BigExplosionEffect(Game, X, Y, Game.Random.Next(0, 360), 255, 255, 255);
                        Game.AddEffect(effect);
                        Game.PlaySound(Sound.Explosion);
                    }
                }
                return;
            }

            if (moveCount > 0)
            {
                moveCount--;
            }
            else
            {
                targetX = Game.FieldWidth / 2 + Game.Random.Next(-64, 64 + 1);
                targetY = Game.FieldHeight / 4 - Game.Random.Next(0, 64 + 1);
                moveCount = Game.Random.Next(30, 60);
            }

            spawnEnemyType = (192 - hitPoints) / 32;
            if (!Game.Player.IsDead && !isDying && Game.Ticks >= 60)
            {
                switch (spawnEnemyType)
                {
                    case 0:
                        if (Game.Ticks % 8 == 0)
                        {
                            Effect effect = new GreenEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                    case 1:
                        if (Game.Ticks % 8 == 0)
                        {
                            Effect effect = new BlueEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                    case 2:
                        if (Game.Ticks % 8 == 0)
                        {
                            Effect effect = new RedEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                    case 3:
                        if (Game.Ticks % 16 == 0)
                        {
                            Effect effect = new OrangeEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                    case 4:
                        if (Game.Ticks % 16 == 0)
                        {
                            Effect effect = new MissileEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                    case 5:
                        if (Game.Ticks % 16 == 0)
                        {
                            Effect effect = new KurageSpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                            Game.AddEffect(effect);
                        }
                        break;
                }
            }
            else
            {
                hitPoints = 192;
            }

            x2 = targetX * 0.125 + x2 * 0.875;
            y2 = targetY * 0.125 + y2 * 0.875;
            X = x2 * 0.125 + X * 0.875;
            Y = y2 * 0.125 + Y * 0.875;

            animation = (animation + 1) % 8;
        }
예제 #2
0
        public override void Update()
        {
            damaged = false;

            if (isDying)
            {
                if (dyingCount < 60)
                {
                    if (dyingCount % 2 == 0)
                    {
                        Effect effect = new SmallExplosionEffect(Game, X + Game.Random.Next(-32, 32 + 1), Y + Game.Random.Next(-32, 32 + - +1), Game.Random.Next(0, 360));
                        Game.AddEffect(effect);
                        if (dyingCount % 4 == 0)
                        {
                            Game.PlaySound(Sound.Explosion);
                        }
                    }
                    dyingCount++;
                    if (dyingCount == 60)
                    {
                        Effect effect = new BigExplosionEffect(Game, X, Y, Game.Random.Next(0, 360), 255, 255, 255);
                        Game.AddEffect(effect);
                        Game.PlaySound(Sound.Explosion);
                    }
                }
                return;
            }

            if (moveCount > 0)
            {
                moveCount--;
            }
            else
            {
                targetX   = Game.FieldWidth / 2 + Game.Random.Next(-64, 64 + 1);
                targetY   = Game.FieldHeight / 4 - Game.Random.Next(0, 64 + 1);
                moveCount = Game.Random.Next(30, 60);
            }

            spawnEnemyType = (192 - hitPoints) / 32;
            if (!Game.Player.IsDead && !isDying && Game.Ticks >= 60)
            {
                switch (spawnEnemyType)
                {
                case 0:
                    if (Game.Ticks % 8 == 0)
                    {
                        Effect effect = new GreenEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;

                case 1:
                    if (Game.Ticks % 8 == 0)
                    {
                        Effect effect = new BlueEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;

                case 2:
                    if (Game.Ticks % 8 == 0)
                    {
                        Effect effect = new RedEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;

                case 3:
                    if (Game.Ticks % 16 == 0)
                    {
                        Effect effect = new OrangeEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;

                case 4:
                    if (Game.Ticks % 16 == 0)
                    {
                        Effect effect = new MissileEnemySpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;

                case 5:
                    if (Game.Ticks % 16 == 0)
                    {
                        Effect effect = new KurageSpawner(Game, X + Game.Random.Next(-64, 65), Y + Game.Random.Next(0, 64));
                        Game.AddEffect(effect);
                    }
                    break;
                }
            }
            else
            {
                hitPoints = 192;
            }

            x2 = targetX * 0.125 + x2 * 0.875;
            y2 = targetY * 0.125 + y2 * 0.875;
            X  = x2 * 0.125 + X * 0.875;
            Y  = y2 * 0.125 + Y * 0.875;

            animation = (animation + 1) % 8;
        }