示例#1
0
        /// <summary>
        /// Begins to exit a pipe.
        /// </summary>
        /// <param name="name"></param>
        public void BeginExitPipe(string name)
        {
            var pipe = pipes.FirstOrDefault(x => x.PipeType == Pipe.PipeTypes.Exit && x.Destination.ToUpper() == name.ToUpper());

            if (pipe != null)
            {
                isSitting       = false;
                movementSpeed   = 0;
                movingDirection = MovingDirection.Right;
                Flipped         = false;
                SetSpriteFrame("mario_move_0");

                var x = (int)pipe.BoundingBox.X - 80 - level.GetScrollX();
                level.SetOffset(-x, 0);

                if (isTiny)
                {
                    Position = new Vector2(80, pipe.BoundingBox.Y - 8);
                }
                else
                {
                    Position = new Vector2(80, pipe.BoundingBox.Y);
                }

                HandleScrollingLeft();
                EntityManager.SetDrawOffset(level.GetScrollX());

                Visible           = true;
                isExitingPipe     = true;
                exitPipeMaxCount  = isTiny ? 24 : 32;
                ClipBottomAmount  = 32;
                exitPipeCount     = 0;
                pipeSlowerCounter = 0;
            }
        }