Ejemplo n.º 1
0
 private static void QueueCrash(ref CharaFlag charaFlag, ref CharaQueue charaQueue)
 {
     if (charaFlag.m_mapFlag.IsFlag(FlagMapCheck.Crash))
     {
         // charaQueue.SetQueue(EnumMotionType.Land);
     }
 }
Ejemplo n.º 2
0
 private static void QueueFall(ref CharaFlag charaFlag, ref CharaQueue charaQueue)
 {
     if (charaFlag.m_mapFlag.IsFlag(FlagMapCheck.Fall))
     {
         charaQueue.SetQueue(EnumMotionType.Jump);
     }
 }
Ejemplo n.º 3
0
            private void CheckFall(ref CharaPos charaPos, ref CharaFlag charaFlag, ref CharaQueue charaQueue, int startY)
            {
                // 浮きチェック(Y補正をしていたら浮きチェックは不要)
                bool isMovedY = (startY != charaPos.m_posY);

                if (isMovedY)
                {
                    return;
                }

                // 落下可能
                bool isFallable = charaFlag.m_mapFlag.IsFlag(FlagMapCheck.Fall);

                if (!isFallable)
                {
                    return;
                }

                // 3点の壁・斜め壁チェック
                bool isFloatRight  = CheckFloatWall(XPos.Right, ref charaPos, ref charaFlag, ref charaQueue);
                bool isFloatLeft   = CheckFloatWall(XPos.Left, ref charaPos, ref charaFlag, ref charaQueue);
                bool isFloatCenter = CheckFloatWall(XPos.Center, ref charaPos, ref charaFlag, ref charaQueue);

                if (isFloatRight && isFloatLeft && isFloatCenter)
                {
                    QueueFall(ref charaFlag, ref charaQueue);
                }
            }
Ejemplo n.º 4
0
            private void AttractSlope(ref CharaPos charaPos, ref CharaLastPos charaLastPos,
                                      ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                // 浮いている場合は補正しない
                if (!charaFlag.m_mapFlag.IsFlag(FlagMapCheck.Slope))
                {
                    return;
                }

                EnumShapeType shape       = GetShape(charaPos.m_mapXCenter, charaPos.m_mapY, charaPos.m_mapZ);
                EnumShapeType bottomShape = GetShape(charaPos.m_mapXCenter, charaPos.m_mapY - 1, charaPos.m_mapZ);

                //

                int newY = 0;

                if (shape.IsSlope())
                {
                    // 現チップが坂
                    newY = (charaPos.m_mapY << PIX_MAP) + GetSlopeBorder(shape, charaPos.m_tipXCenter) + 1;
                }
                else if (shape.IsEmpty() && bottomShape.IsSlope())
                {
                    // もしくは、現チップが空で、下のチップが坂
                    newY = ((charaPos.m_mapY - 1) << PIX_MAP) + GetSlopeBorder(bottomShape, charaPos.m_tipXCenter) + 1;
                }
                else
                {
                    return;
                }

                charaPos.SetPixY(newY);
            }
 void LandFlags(ref CharaFlag charaFlag)
 {
     charaFlag.m_inputCheckFlag = FlagInputCheck.None;
     charaFlag.m_moveFlag       = FlagMove.None;
     charaFlag.m_motionFlag     = FlagMotion.None;
     charaFlag.m_mapFlag        = FlagMapCheck.Fall | FlagMapCheck.Slope;
     charaFlag.m_mukiFlag       = false;
 }
 void JumpFlags(ref CharaFlag charaFlag)
 {
     charaFlag.m_inputCheckFlag = FlagInputCheck.Slip;
     charaFlag.m_moveFlag       = FlagMove.Air;
     charaFlag.m_motionFlag     = FlagMotion.Jump;
     charaFlag.m_mapFlag        = FlagMapCheck.Stick;
     charaFlag.m_mukiFlag       = true;
 }
 void DashFlags(ref CharaFlag charaFlag)
 {
     charaFlag.m_inputCheckFlag = FlagInputCheck.Jump | FlagInputCheck.Slip;
     charaFlag.m_moveFlag       = FlagMove.Dash;
     charaFlag.m_motionFlag     = FlagMotion.Dash;
     charaFlag.m_mapFlag        = FlagMapCheck.Fall | FlagMapCheck.Stick | FlagMapCheck.Slope;
     charaFlag.m_mukiFlag       = true;
 }
 void WalkFlags(ref CharaFlag charaFlag)
 {
     charaFlag.m_inputCheckFlag = FlagInputCheck.Jump | FlagInputCheck.Dash | FlagInputCheck.Idle;
     charaFlag.m_moveFlag       = FlagMove.Walk;
     charaFlag.m_motionFlag     = FlagMotion.Move;
     charaFlag.m_mapFlag        = FlagMapCheck.Fall | FlagMapCheck.Stick | FlagMapCheck.Slope;
     charaFlag.m_mukiFlag       = true;
 }
Ejemplo n.º 9
0
            private void CheckXBox(XPos xPos, ref CharaPos charaPos, ref CharaLastPos charaLastPos,
                                   ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                int mapX     = 0;
                int lastMapX = 0;
                int sideMapX = 0;
                int offsetX  = 0;

                switch (xPos)
                {
                case XPos.Left:
                    mapX     = charaPos.m_mapXLeft;
                    lastMapX = charaLastPos.m_mapXLeft;
                    sideMapX = mapX + 1;
                    offsetX  = TIP_SIZE + SIDE_OFFSET;
                    break;

                case XPos.Center:
                    mapX     = charaPos.m_mapXCenter;
                    lastMapX = charaLastPos.m_mapXCenter;
                    break;

                case XPos.Right:
                    mapX     = charaPos.m_mapXRight;
                    lastMapX = charaLastPos.m_mapXRight;
                    sideMapX = mapX - 1;
                    offsetX  = -1 - SIDE_OFFSET;
                    break;
                }

                // MapX移動が無いときはチェックしない
                if (mapX == lastMapX)
                {
                    return;
                }

                // 横が空の時のみ、壁チェック
                EnumShapeType sideShape = GetShape(sideMapX, charaPos.m_mapY, charaPos.m_mapZ);

                if (!sideShape.IsEmpty())
                {
                    return;
                }

                // ブロックのみ補正行う、斜め壁は別途
                EnumShapeType shape = GetShape(mapX, charaPos.m_mapY, charaPos.m_mapZ);

                if (!shape.IsBox())
                {
                    return;
                }

                // 中心位置への補正SIDE_OFFSET
                int newX = (mapX << PIX_MAP) + offsetX;

                charaPos.SetPixX(newX);
                QueueCrash(ref charaFlag, ref charaQueue);
            }
Ejemplo n.º 10
0
            void UpdateGravity(ref CharaDelta charaDelta, ref CharaFlag charaFlag, int gravity)
            {
                charaDelta.m_deltaY -= gravity;

                if (!charaFlag.m_mapFlag.IsFlag(FlagMapCheck.Land) &&
                    charaDelta.m_deltaY < 0)
                {
                    charaFlag.m_mapFlag.AddFlag(FlagMapCheck.Land);
                }
            }
Ejemplo n.º 11
0
            private bool CheckFloatWall(XPos xPos, ref CharaPos charaPos, ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                // tipYが中途半端な場合は浮いている
                if (charaPos.m_tipY != 0)
                {
                    return(true);
                }

                int mapX = 0;
                int tipX = 0;

                switch (xPos)
                {
                case XPos.Left:
                    mapX = charaPos.m_mapXLeft;
                    tipX = charaPos.m_tipXLeft;
                    break;

                case XPos.Center:
                    mapX = charaPos.m_mapXCenter;
                    tipX = charaPos.m_tipXCenter;
                    break;

                case XPos.Right:
                    mapX = charaPos.m_mapXRight;
                    tipX = charaPos.m_tipXRight;
                    break;
                }

                // ひとつ下のチップをチェック
                EnumShapeType bottomShape = GetShape(mapX, charaPos.m_mapY - 1, charaPos.m_mapZ);

                bool isFloat = false;

                switch (bottomShape)
                {
                case EnumShapeType.Box:
                    isFloat = false;
                    break;

                case EnumShapeType.BSlashWall:
                    isFloat = (tipX < (TIP_SIZE - 1 - charaPos.m_tipZ));
                    break;

                case EnumShapeType.SlashWall:
                    isFloat = (tipX > charaPos.m_tipZ);
                    break;

                default:
                    isFloat = true;
                    break;
                }

                return(isFloat);
            }
Ejemplo n.º 12
0
            private void CheckZBox(XPos xPos, ref CharaPos charaPos, ref CharaLastPos charaLastPos,
                                   ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                // MapZ移動が無いときはZチェックしない
                if (charaPos.m_mapZ == charaLastPos.m_mapZ)
                {
                    return;
                }

                int mapX = 0;

                switch (xPos)
                {
                case XPos.Left:
                    mapX = charaPos.m_mapXLeft;
                    break;

                case XPos.Center:
                    mapX = charaPos.m_mapXCenter;
                    break;

                case XPos.Right:
                    mapX = charaPos.m_mapXRight;
                    break;
                }

                // 手前が壁以外のときのみ壁チェック
                EnumShapeType frontShape = GetShape(mapX, charaPos.m_mapY, charaPos.m_mapZ - 1);

                if (frontShape.IsBox())
                {
                    return;
                }

                // ブロックのみ補正行う、斜め壁は別途
                EnumShapeType shape = GetShape(mapX, charaPos.m_mapY, charaPos.m_mapZ);

                if (!shape.IsBox())
                {
                    return;
                }


                int newRZ = (charaPos.m_mapZ << PIX_MAP) - 1;

                Debug.Log($"charaPos.m_mapZ : {charaPos.m_mapZ} charaLastPos.m_mapZ {charaLastPos.m_mapZ}");
                charaPos.SetPixZ(newRZ);
            }
Ejemplo n.º 13
0
            private void CheckYSlope(ref CharaPos charaPos, ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                EnumShapeType shape = GetShape(charaPos.m_mapXCenter, charaPos.m_mapY, charaPos.m_mapZ);

                if (!shape.IsSlope())
                {
                    return;
                }

                // 坂座標
                int borderY = GetSlopeBorder(shape, charaPos.m_tipXCenter);

                if (charaPos.m_tipY <= borderY)
                {
                    int newY = (charaPos.m_mapY << PIX_MAP) + borderY + 1;
                    charaPos.SetPixY(newY);
                    QueueLand(ref charaFlag, ref charaQueue);
                }
            }
Ejemplo n.º 14
0
            private void CheckXZSlashWall(XPos xPos, ref CharaPos charaPos, ref CharaLastPos charaLastPos,
                                          ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                int mapX    = 0;
                int tipX    = 0;
                int offsetX = 0;

                switch (xPos)
                {
                case XPos.Left:
                    mapX    = charaPos.m_mapXLeft;
                    tipX    = charaPos.m_tipXLeft;
                    offsetX = +1 + SIDE_OFFSET;
                    break;

                case XPos.Center:
                    mapX = charaPos.m_mapXCenter;
                    tipX = charaPos.m_tipXCenter;
                    break;

                case XPos.Right:
                    mapX    = charaPos.m_mapXRight;
                    tipX    = charaPos.m_tipXRight;
                    offsetX = -1 - SIDE_OFFSET;
                    break;
                }

                EnumShapeType shape = GetShape(mapX, charaPos.m_mapY, charaPos.m_mapZ);

                if (!shape.IsSlashWall())
                {
                    return;
                }


                int  moveX    = math.abs(charaPos.m_posX - charaLastPos.m_posX);
                int  moveZ    = math.abs(charaPos.m_posZ - charaLastPos.m_posZ);
                bool isZSlide = (moveX > moveZ);

                if (isZSlide)
                {
                    // 斜め壁座標
                    int  borderX = 0;
                    int  shiftZ  = 0;
                    bool isHit   = false;
                    switch (shape)
                    {
                    case EnumShapeType.SlashWall:
                        borderX = charaPos.m_tipZ;
                        shiftZ  = -(tipX + 1);
                        isHit   = tipX <= borderX;
                        break;

                    case EnumShapeType.BSlashWall:
                        borderX = TIP_SIZE - 1 - charaPos.m_tipZ;
                        shiftZ  = -(TIP_SIZE - tipX);
                        isHit   = tipX >= borderX;
                        break;
                    }

                    if (isHit)
                    {
                        int newZ = ((charaPos.m_mapZ + 1) << PIX_MAP) + shiftZ;
                        charaPos.SetPixZ(newZ);
                    }
                }
                else
                {
                    int borderZ = 0;
                    int shiftX  = 0;
                    switch (shape)
                    {
                    case EnumShapeType.SlashWall:
                        borderZ = tipX;
                        shiftX  = charaPos.m_tipZ + 1;
                        break;

                    case EnumShapeType.BSlashWall:
                        borderZ = TIP_SIZE - 1 - tipX;
                        shiftX  = -(TIP_SIZE - charaPos.m_tipZ);
                        break;
                    }

                    if (charaPos.m_tipZ >= borderZ)
                    {
                        int newX = (mapX << PIX_MAP) + shiftX + offsetX;
                        charaPos.SetPixX(newX);
                    }
                }
            }
Ejemplo n.º 15
0
            private void CheckYWall(XPos xPos, ref CharaPos charaPos, ref CharaLastPos charaLastPos,
                                    ref CharaFlag charaFlag, ref CharaQueue charaQueue)
            {
                // MapX移動が無いときはチェックしない
                if (charaPos.m_mapY == charaLastPos.m_mapY)
                {
                    return;
                }

                int mapX     = 0;
                int sideMapX = 0;

                switch (xPos)
                {
                case XPos.Left:
                    mapX     = charaPos.m_mapXLeft;
                    sideMapX = mapX + 1;
                    break;

                case XPos.Center:
                    mapX     = charaPos.m_mapXCenter;
                    sideMapX = mapX;
                    break;

                case XPos.Right:
                    mapX     = charaPos.m_mapXRight;
                    sideMapX = mapX - 1;
                    break;
                }

                EnumShapeType sideShape = GetShape(sideMapX, charaPos.m_mapY, charaPos.m_mapZ);

                // 横が坂の場合は判定しない
                if (sideShape.IsSlope())
                {
                    return;
                }

                EnumShapeType topShape = GetShape(mapX, charaPos.m_mapY + 1, charaPos.m_mapZ);
                EnumShapeType shape    = GetShape(mapX, charaPos.m_mapY, charaPos.m_mapZ);

                //ひとつ上と同じチップの場合はチェックしない
                if (shape == topShape)
                {
                    return;
                }

                // Yめり込みチェック
                bool isHit = false;

                switch (shape)
                {
                case EnumShapeType.Box:
                    isHit = true;
                    break;

                case EnumShapeType.BSlashWall:
                    isHit = (xPos == XPos.Right) && (charaPos.m_tipXRight >= (TIP_SIZE - 1 - charaPos.m_tipZ));
                    break;

                case EnumShapeType.SlashWall:
                    isHit = (xPos == XPos.Left) && (charaPos.m_tipXLeft <= charaPos.m_tipZ);
                    break;
                }

                if (isHit)
                {
                    int newY = (charaPos.m_mapY + 1) << PIX_MAP;
                    charaPos.SetPixY(newY);
                    QueueLand(ref charaFlag, ref charaQueue);
                }
            }