Exemple #1
0
        private void Open()
        {
            //Closes all other checkpoints.
            for (int i = 0; i < GameWorld.Instance.Entities.Count; i++)
            {
                Entity en = GameWorld.Instance.Entities[i];
                if (en is CheckPoint)
                {
                    if (en == this)
                        continue;
                    CheckPoint ch = (CheckPoint)en;
                    ch.Close();
                }
            }

            //Open this checkpoint.
            _isOpen = true;
            _quack.PlayIfStopped();
            _openSound.PlayIfStopped();

            //Sets respawn point;
            Player.Player player = GameWorld.Instance.Player;
            player.SetRespawnPoint(DrawRectangle.X, DrawRectangle.Y);

            //Particle effects
            for (int i = 0; i < 100; i++)
            {
                Particle par = new Particle();
                par.CreateSparkles(this);
                GameWorld.Instance.Particles.Add(par);
            }
        }