示例#1
0
 public void DisableVPipes(ArrayList pipePosition)
 {
     if (pipePosition is null)
     {
         throw new ArgumentNullException(nameof(pipePosition));
     }
     foreach (ICharacter character in CharacterList)
     {
         if (pipePosition.Contains(character.GetMinPosition.X) && character.Type == Sprint5Main.CharacterType.Pipe)
         {
             PipeCharacter pipe = (PipeCharacter)character;
             pipe.MarioGetInside();
         }
     }
 }
示例#2
0
        public void CollideWithPipe(PipeCharacter pipe, bool upOrDown, bool movingDown)
        {
            if (Parameters.Position.X >= pipe?.GetMinPosition.X + 2 && GetMaxPosition.X <= pipe.GetMaxPosition.X - 2)
            {
                OnPipe = true;
            }
            switch (pipe?.PType)
            {
            case PipeCharacter.PipeType.Pipe: CollideWithBlock(upOrDown, movingDown); break;

            case PipeCharacter.PipeType.VPipe:
                if (upOrDown && OnPipePressDown && OnPipe)
                {
                    Mario.DiveIn(pipe.GetMinPosition.Y); pipe.MarioGetInside();
                    DivedPipe.Add(pipe.GetMinPosition.X); SoundFactory.Instance.GetIntoPipe();
                }
                else
                {
                    CollideWithBlock(upOrDown, movingDown);
                }
                break;

            case PipeCharacter.PipeType.HPipe:
                if (!upOrDown && Parameters.Velocity.X > 0 && GetMinPosition.Y >= pipe.GetMinPosition.Y &&
                    GetMaxPosition.Y <= pipe.GetMaxPosition.X)
                {
                    Mario.DiveInRight(pipe.GetMinPosition.X, pipe.GetMaxPosition.Y);
                    SoundFactory.Instance.GetIntoPipe();
                }
                else
                {
                    CollideWithBlock(upOrDown, movingDown);
                }
                break;

            default: break;
            }
        }