コード例 #1
0
        private string buildImageFullPath(string assetName, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations orientation)
        {
            string imageFullPath;

            imageFullPath = "data/img/tiles/" + assetName + "_" + DGlobal.mapDistanceToString(distance) + "_" + DGlobal.mapPositionToString(position) + "_" + DGlobal.mapOrientationToString(orientation) + ".png";

            return(imageFullPath);
        }
コード例 #2
0
ファイル: DCharacter.cs プロジェクト: jordirosa/Dungeon
 private void loadTile(DGlobal.MapDistances distance, DGlobal.MapPositions position, string assetName)
 {
     mCharacterset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.NORTH] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.CharacterPieces.BODY));
     mCharacterset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.EAST]  = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.CharacterPieces.ARM_LEFT));
     mCharacterset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.SOUTH] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.CharacterPieces.ARM_RIGHT));
     mCharacterset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.WEST]  = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.CharacterPieces.ARM_LEFT_EQUIPPED));
     mCharacterset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.FLOOR] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.CharacterPieces.ARM_RIGHT_EQUIPPED));
 }
コード例 #3
0
ファイル: DCharacter.cs プロジェクト: jordirosa/Dungeon
        private string buildImageFullPath(string assetName, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.CharacterPieces piece)
        {
            string imageFullPath;

            imageFullPath = "data/img/character/" + assetName + "_" + DGlobal.mapDistanceToString(distance) + "_" + DGlobal.mapPositionToString(position) + "_" + DGlobal.characterPieceToString(piece) + ".png";

            return(imageFullPath);
        }
コード例 #4
0
 private void loadTile(DGlobal.MapDistances distance, DGlobal.MapPositions position, string assetName)
 {
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.NORTH] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.NORTH));
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.EAST]  = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.EAST));
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.SOUTH] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.SOUTH));
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.WEST]  = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.WEST));
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.FLOOR] = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.FLOOR));
     mTileset[0, (int)distance, (int)position, (int)DGlobal.MapOrientations.CEIL]  = this.mGraphics.loadImage(buildImageFullPath(assetName, distance, position, DGlobal.MapOrientations.CEIL));
 }
コード例 #5
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]);
                }
            }
        }
コード例 #6
0
        private void drawTile(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations lookOrientation)
        {
            DGlobal.MapOrientations orientation = lookOrientation;

            if (position == DGlobal.MapPositions.CENTER)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
            else if (position == DGlobal.MapPositions.RIGHT1 || position == DGlobal.MapPositions.RIGHT2)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
            else if (position == DGlobal.MapPositions.LEFT1 || position == DGlobal.MapPositions.LEFT2)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
0
ファイル: DCharacter.cs プロジェクト: jordirosa/Dungeon
        public void draw(DGlobal.MapDistances distance, DGlobal.MapPositions position)
        {
            if (this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.BODY] != null)
            {
                this.mGraphics.drawImage(this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.BODY]);
            }

            if (this.mLeftArmEquipped == false)
            {
                if (this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_LEFT] != null)
                {
                    this.mGraphics.drawImage(this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_LEFT]);
                }
            }
            else
            {
                if (this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_LEFT_EQUIPPED] != null)
                {
                    this.mGraphics.drawImage(this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_LEFT_EQUIPPED]);
                }
            }

            if (this.mRightArmEquipped == false)
            {
                if (this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_RIGHT] != null)
                {
                    this.mGraphics.drawImage(this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_RIGHT]);
                }
            }
            else
            {
                if (this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_RIGHT_EQUIPPED] != null)
                {
                    this.mGraphics.drawImage(this.mCharacterset[0, (int)distance, (int)position, (int)DGlobal.CharacterPieces.ARM_RIGHT_EQUIPPED]);
                }
            }
        }