コード例 #1
0
        private void drawTileOrientation(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations orientation, DGlobal.MapOrientations lookOrientation)
        {
            int positionX = x;
            int positionY = y;

            DGlobal.MapOrientations drawingOrientation = orientation;

            switch (lookOrientation)
            {
            case DGlobal.MapOrientations.WEST:
                DGlobal.turnRight(ref drawingOrientation);
                break;

            case DGlobal.MapOrientations.EAST:
                DGlobal.turnLeft(ref drawingOrientation);
                break;

            case DGlobal.MapOrientations.SOUTH:
                DGlobal.turnBack(ref drawingOrientation);
                break;
            }

            switch (position)
            {
            case DGlobal.MapPositions.RIGHT1:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.RIGHT2:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 2);
                break;

            case DGlobal.MapPositions.LEFT1:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.LEFT2:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 2);
                break;
            }

            DGlobal.moveForward(lookOrientation, ref positionX, ref positionY, (int)distance);

            if (positionX >= 0 && positionX < this.mWidth && positionY >= 0 && positionY < this.mHeight)
            {
                if (this.mMapData[positionX, positionY, (int)orientation] > 0 && this.mTileset[(this.mMapData[positionX, positionY, (int)orientation]) - 1, (int)distance, (int)position, (int)drawingOrientation] != null)
                {
                    this.mGraphics.drawImage(this.mTileset[(this.mMapData[positionX, positionY, (int)orientation]) - 1, (int)distance, (int)position, (int)drawingOrientation]);
                }
            }
        }
コード例 #2
0
        private void drawCharacter(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations lookOrientation)
        {
            DCharacter character = null;

            int positionX = x;
            int positionY = y;

            switch (position)
            {
            case DGlobal.MapPositions.RIGHT1:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.RIGHT2:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 2);
                break;

            case DGlobal.MapPositions.LEFT1:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.LEFT2:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 2);
                break;
            }

            DGlobal.moveForward(lookOrientation, ref positionX, ref positionY, (int)distance);

            foreach (DCharacter characterTMP in this.mCharacters)
            {
                if (characterTMP.getPositionX() == positionX && characterTMP.getPositionY() == positionY)
                {
                    character = characterTMP;
                    break;
                }
            }

            if (character != null)
            {
                character.draw(distance, position);
            }
        }