Exemple #1
0
        public void RunGameLoopOnce()
        {
            // Process player actions
            Players.ForEach(player =>
            {
                if (player.IsKilled)
                {
                    if (player.DeathTimer++ < Constants.DeathTimeLimit)
                    {
                        return;
                    }
                    RespawnPlayer(player);
                }

                if (player.ActionType == null)
                {
                    return;
                }
                player.ActionType.Process(player, this);
                player.ActionType = null;
            });

            // Process all Actors
            ActorList.ForEach(actor => actor.Process(this));

            // Move bullets forward by one
            BulletList.ForEach(bullet => bullet.Process(this));

            // Remove dead shots
            List <Bullet> deadBullets = BulletList.Where(x => x.Collided == true).ToList();

            deadBullets.ForEach(x => BulletList.Remove(x));
        }
Exemple #2
0
 public override void Ctrl()
 {
     if (Time % CtrlCircle == 0)
     {
         KC = new KeyClass {
             Key_Z = true
         };
         Vector2 move = GenerateMove();
         double  num1 = -move.X;
         double  num2 = -move.Y;
         if (move.Length() < 80.0)
         {
             KC.Key_Shift = true;
         }
         if (num1 > 1.0)
         {
             KC.ArrowLeft = true;
         }
         else if (num1 < -1.0)
         {
             KC.ArrowRight = true;
         }
         if (num2 > 1.0)
         {
             KC.ArrowUp = true;
         }
         else if (num2 < -1.0)
         {
             KC.ArrowDown = true;
         }
     }
     BulletList.ForEach(x => {
         if (!x.HitCheck(this, x.Region) && DeadTime <= Time)
         {
             return;
         }
         KC.Key_X = true;
     });
     StageData.GlobalData.KClass.Hex2Key(KC.Key2Hex());
     base.Ctrl();
 }