예제 #1
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state)
        {
            base.SetupBlock(type, state);
#if UNITY_EDITOR
            this.SetMiscMaterial();
#endif
            this.blockMaterials[1]       = this.switchDownMaterial;
            this.blockRenderer.materials = this.blockMaterials;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridMap"/> class.
 /// </summary>
 public GridMap()
 {
     this.rows          = 5;
     this.columns       = 5;
     this._blockWidth   = BlockInfo.BlockWidth;
     this._blockHeight  = BlockInfo.BlockHeight;
     this._blockBreadth = BlockInfo.BlockBreadth;
     this.blockToPlace  = BlockInfo.BlockTypes.NONE;
 }
예제 #3
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state)
        {
            base.SetupBlock(type, state);

            if (state == BlockInfo.BlockState.UP)
            {
                this.isReversed = true;
            }
        }
예제 #4
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, int initCounter)
        {
            this._blockType  = type;
            this._blockState = BlockInfo.BlockState.NONE;

            this._firstDirection  = BlockInfo.BlockDirection.NONE;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this.SetTileMaterial();
        }
예제 #5
0
        public virtual void SetupBlock()
        {
            this._blockType  = BlockInfo.BlockTypes.NONE;
            this._blockState = BlockInfo.BlockState.NONE;

            this._firstDirection  = BlockInfo.BlockDirection.NONE;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this.SetTileMaterial();
        }
예제 #6
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection firstDirection, BlockInfo.BlockDirection secondDirection)
        {
            base.SetupBlock(type, firstDirection, secondDirection);

            this.isUp = false;
#if UNITY_EDITOR
            this.SetMiscMaterial();
#endif
            this.blockRenderer.sharedMaterials = this.blockMaterials;
        }
예제 #7
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state)
        {
            this._blockType     = type;
            this._blockState    = state;
            this._previousState = state;

            this._firstDirection  = BlockInfo.BlockDirection.NONE;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this.SetTileMaterial();
        }
예제 #8
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state, int initCounter)
        {
            base.SetupBlock(type, state, initCounter);

            this.stunCounter = initCounter;
#if UNITY_EDITOR
            this.SetMiscMaterial();
#endif
            this.blockMaterials[1]       = stunDownMaterial;
            this.blockRenderer.materials = this.blockMaterials;
        }
예제 #9
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection direction, BlockInfo.BlockState state)
        {
            base.SetupBlock(type, direction, state);

            this.warpDirection = (PlayerInfo.MovementDirection)((int)direction);
#if UNITY_EDITOR
            this.SetMiscMaterial();
#endif
            this.blockMaterials[1]             = this.warpDownMaterial;
            this.blockRenderer.sharedMaterials = this.blockMaterials;
        }
예제 #10
0
        public override void SetupBlock(BlockInfo.BlockTypes type, int initCounter)
        {
            base.SetupBlock(type, initCounter);

            //this._maxCount = initCounter;
            this.previousBreakCount = initCounter;
            this.breakCount         = initCounter;

#if UNITY_EDITOR
            this.SetMiscMaterial();
#endif
        }
예제 #11
0
        public override void SetupBlock(BlockInfo.BlockTypes type, int initCounter)
        {
            base.SetupBlock(type, initCounter);

            this.currentCounter  = initCounter;
            this.previousCounter = initCounter;
            this.maxCounter      = initCounter;

            this.blockMaterials[1]       = this.numberMaterials[currentCounter];
            this.blockRenderer.materials = this.blockMaterials;

            this.isReversed = false;
        }
예제 #12
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection direction)
        {
            this._blockType  = type;
            this._blockState = BlockInfo.BlockState.NONE;

            this._firstDirection  = direction;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this._blockDirections.Add(direction);

            this.firstDirectionValue = (int)direction;

            this.SetTileMaterial();
        }
예제 #13
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection firstDirection, BlockInfo.BlockDirection secondDirection, BlockInfo.BlockState state)
        {
            this._blockType     = type;
            this._blockState    = state;
            this._previousState = state;

            this._firstDirection  = firstDirection;
            this._secondDirection = secondDirection;

            this._blockDirections.Add(firstDirection);
            this._blockDirections.Add(secondDirection);

            this.firstDirectionValue  = (int)firstDirection;
            this.secondDirectionValue = (int)secondDirection;

            this.SetTileMaterial();
        }
예제 #14
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection firstDirection, BlockInfo.BlockDirection secondDirection, BlockInfo.BlockState state)
        {
            base.SetupBlock(type, firstDirection, secondDirection, state);

            if (state == BlockInfo.BlockState.UP)
            {
                this.isUp = true;
#if UNITY_EDITOR
                this.SetMiscMaterial();
#endif
                this.blockRenderer.sharedMaterials = this.blockMaterials;
            }
            else
            {
#if UNITY_EDITOR
                this.SetMiscMaterial();
#endif
                this.blockRenderer.sharedMaterials = this.blockMaterials;
            }
        }
예제 #15
0
        public override void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state, int initCounter)
        {
            base.SetupBlock(type, state, initCounter);

            //this._maxCount = initCounter;
            this.previousBreakCount = initCounter;
            this.breakCount         = initCounter;

#if UNITY_EDITOR
            this.SetMiscMaterial();
            if (this.BlockState == BlockInfo.BlockState.UP)
            {
                this.blockMaterials[0] = this.tileUpMaterial;
            }
            else
            {
                this.blockMaterials[0] = this.tileDownMaterial;
            }
            this.blockRenderer.sharedMaterials = this.blockMaterials;
#endif
        }
예제 #16
0
 public override void SetupBlock(BlockInfo.BlockTypes type)
 {
     base.SetupBlock(type);
 }
예제 #17
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type) {
            this._blockType = type;
            this._blockState = BlockInfo.BlockState.NONE;

            this._firstDirection = BlockInfo.BlockDirection.NONE;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this.SetTileMaterial();
        }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridMap"/> class.
 /// </summary>
 public GridMap() {
     this.rows = 5;
     this.columns = 5;
     this._blockWidth = BlockInfo.BlockWidth;
     this._blockHeight = BlockInfo.BlockHeight;
     this._blockBreadth = BlockInfo.BlockBreadth;
     this.blockToPlace = BlockInfo.BlockTypes.NONE;
 }
예제 #19
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection direction) {
            this._blockType = type;
            this._blockState = BlockInfo.BlockState.NONE;

            this._firstDirection = direction;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this._blockDirections.Add(direction);

            this.firstDirectionValue = (int)direction;

            this.SetTileMaterial();
        }
예제 #20
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockDirection firstDirection, BlockInfo.BlockDirection secondDirection, BlockInfo.BlockState state) {
            this._blockType = type;
            this._blockState = state;
            this._previousState = state;

            this._firstDirection = firstDirection;
            this._secondDirection = secondDirection;

            this._blockDirections.Add(firstDirection);
            this._blockDirections.Add(secondDirection);

            this.firstDirectionValue = (int)firstDirection;
            this.secondDirectionValue = (int)secondDirection;

            this.SetTileMaterial();
        }
예제 #21
0
        /// <summary>
        /// create a set of block info from .tmx file
        /// </summary>
        /// <param name="tmx path">path of tmx path</param>
        /// <returns>the created set of block info</returns>
        /// <remarks>
        /// .tmx file is the output format of Tiled Map Editor (http://www.mapeditor.org/)
        /// block info represents
        /// </remarks>
        public static BlockInfo[,] CreateBlockInfoMap(string tmxPath)
        {
            // create map block
            {
                var doc            = XElement.Load(tmxPath);
                int mapBlockWidth  = int.Parse(doc.Attribute("tilewidth").Value);
                int mapBlockHeight = int.Parse(doc.Attribute("tileheight").Value);
                var tileList       = doc.Descendants("layer").Descendants("data").Descendants("tile").ToList();

                var blockInfoMap = new BlockInfo[mapBlockHeight, mapBlockWidth];

                // create blockInfo(s)
                for (int tileIndex = 0; tileIndex < tileList.Count(); ++tileIndex)
                {
                    var tile = tileList[tileIndex];
                    int gid  = int.Parse(tile.Attribute("gid").Value);

                    int i = tileIndex / mapBlockHeight;
                    int j = tileIndex % mapBlockHeight;

                    BlockInfo.BlockTypes type = BlockInfo.BlockTypes.None;

                    if (gid == 3)
                    {
                        // wall
                        type = BlockInfo.BlockTypes.Wall;
                    }
                    else if (gid == 9)
                    {
                        // floor
                        type = BlockInfo.BlockTypes.Floor;
                    }
                    else if (gid == 49)
                    {
                        // closed gate
                        type = BlockInfo.BlockTypes.ClosedGate;
                    }
                    else if (gid == 57)
                    {
                        // start point
                        type = BlockInfo.BlockTypes.StartPoint;
                    }

                    blockInfoMap[i, j] = new BlockInfo(j, i, type);
                }

                // connect
                for (int i = 0; i < mapBlockHeight; ++i)
                {
                    for (int j = 0; j < mapBlockWidth; ++j)
                    {
                        if (i > 0)
                        {
                            blockInfoMap[i, j].North = blockInfoMap[i - 1, j];
                        }

                        if (i < mapBlockHeight - 1)
                        {
                            blockInfoMap[i, j].South = blockInfoMap[i + 1, j];
                        }

                        if (j > 0)
                        {
                            blockInfoMap[i, j].West = blockInfoMap[i, j - 1];
                        }

                        if (j < mapBlockWidth - 1)
                        {
                            blockInfoMap[i, j].East = blockInfoMap[i, j + 1];
                        }
                    }
                }

                return(blockInfoMap);
            }
        }
예제 #22
0
        public virtual void SetupBlock(BlockInfo.BlockTypes type, BlockInfo.BlockState state, int initCounter) {
            this._blockType = type;
            this._blockState = state;
            this._previousState = state;

            this._firstDirection = BlockInfo.BlockDirection.NONE;
            this._secondDirection = BlockInfo.BlockDirection.NONE;

            this.SetTileMaterial();
        }