コード例 #1
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);
            }
コード例 #2
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);
                }
            }
コード例 #3
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);
                }
            }