Пример #1
0
 public override void OnKey(Keys key, ButtonState state, ModifierKeys modifiers)
 {
     if (key == Keys.T && state == ButtonState.Pressed && modifiers.Control)
     {
         MachinaGame.Print("--");
         for (var i = 0; i < transform.ChildCount; i++)
         {
             MachinaGame.Print(transform.ChildAt(i).transform.LocalPosition);
         }
     }
 }
Пример #2
0
        public void StartNextLevel()
        {
            var levels = Level.All;

            MachinaGame.Print("Starting level", this.levelIndex, levels.Length);

            if (levels.Length > this.levelIndex)
            {
                var currentLevel = levels[this.levelIndex];

                for (int i = 0; i < currentLevel.FishCount; i++)
                {
                    var   camWidth = this.actor.scene.camera.ViewportWidth;
                    float randomX  = MachinaGame.Random.CleanRandom.Next(camWidth / 2, camWidth) * ((MachinaGame.Random.CleanRandom.NextDouble() < 0.5) ? -1f : 1f);
                    var   fishPos  = new Vector2(randomX, 0);

                    Game1.SpawnNewFish(
                        this.actor.scene, transform.Position + fishPos, RequireComponent <Player>(), currentLevel.FishStats);
                }

                foreach (var seaweedInfo in currentLevel.Seaweed)
                {
                    Game1.SpawnSeaweed(this.actor.scene, transform.Position, seaweedInfo, this);
                }

                for (int i = 0; i < currentLevel.JellyfishCount; i++)
                {
                    Game1.SpawnJellyfish(this.actor.scene, this);
                }
                this.levelIndex++;
            }
            else
            {
                MachinaGame.Print("Finished!");
            }

            WakeUp();
        }