Пример #1
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();
        }
Пример #2
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;
        }
Пример #3
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();
        }
Пример #4
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();
        }
Пример #5
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;
        }
Пример #6
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();
        }
Пример #7
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();
        }
Пример #8
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;
            }
        }
Пример #9
0
        public void UndoBlocks(PlayerInfo.MovementDirection currentDirection, PlayerInfo.MovementDirection previousDirection)
        {
            int i     = 0;
            int count = 0;

            BlockInfo.BlockDirection current  = (BlockInfo.BlockDirection)((int)currentDirection);
            BlockInfo.BlockDirection previous = (BlockInfo.BlockDirection)((int)previousDirection);

            if (currentDirection == previousDirection)
            {
                if (this._numberBlocks.Count > 0)
                {
                    count = this._numberBlocks.Count;
                    for (i = 0; i < count; i++)
                    {
                        this._numberBlocks[i].Undo();
                    }
                }
                this.blocksReady = true;
                return;
            }

            if (this._numberBlocks.Count > 0)
            {
                count = this._numberBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    this._numberBlocks[i].Undo();
                }
            }

            if (this._normalBlocks.Count > 0)
            {
                count = this._normalBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._normalBlocks[i].FirstDirection == current)
                    {
                        this._normalBlocks[i].BlockState = this._normalBlocks[i].PreviousState;
                    }

                    if (this._normalBlocks[i].FirstDirection == previous)
                    {
                        this._normalBlocks[i].BlockState = this._normalBlocks[i].PreviousState;
                    }
                    else if (previous == BlockInfo.BlockDirection.NONE)
                    {
                        this._normalBlocks[i].BlockState = this._normalBlocks[i].FirstState;
                    }
                }
            }

            if (this._multiBlocks.Count > 0)
            {
                count = this._multiBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._multiBlocks[i].BlockDirections.Contains(current) && !this._multiBlocks[i].BlockDirections.Contains(previous))
                    {
                        this._multiBlocks[i].BlockState = this._multiBlocks[i].PreviousState;
                    }

                    if (this._multiBlocks[i].BlockDirections.Contains(previous))
                    {
                        if (!this._multiBlocks[i].isUp)
                        {
                            this._multiBlocks[i].BlockState = this._multiBlocks[i].PreviousState;
                        }
                    }
                    else if (previous == BlockInfo.BlockDirection.NONE)
                    {
                        this._multiBlocks[i].BlockState = this._multiBlocks[i].FirstState;
                    }
                }
            }

            if (this._switchBlocks.Count > 0)
            {
                count = this._switchBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._switchBlocks[i].IsFlipped)
                    {
                        this._switchBlocks[i].Undo();
                        this._switchBlocks[i].IsFlipped = false;
                    }
                }
            }

            this.blocksReady = true;
        }
Пример #10
0
        /// <summary>
        /// This Function is called whenever the player moves around, so that we can activate the blocks connnected to each movement.
        /// </summary>
        /// <param name="currentDirection">The Current Direction The Player Is Moving At.</param>
        /// <param name="previousDirection">The Previous Direction The Player Was Moving Before.</param>
        public void ActivateBlocks(PlayerInfo.MovementDirection currentDirection, PlayerInfo.MovementDirection previousDirection)
        {
            int i     = 0;
            int count = 0;

            BlockInfo.BlockDirection current = (BlockInfo.BlockDirection)((int)currentDirection);
            //BlockInfo.BlockDirection previous = (BlockInfo.BlockDirection)((int)previousDirection);

            if (currentDirection == previousDirection)
            {
                if (this._numberBlocks.Count > 0)
                {
                    count = this._numberBlocks.Count;
                    for (i = 0; i < count; i++)
                    {
                        if (this._numberBlocks[i].currentCounter == 1)
                        {
                            if (this._numberBlocks[i].isReversed)
                            {
                                this._numberBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                            }
                            else
                            {
                                this._numberBlocks[i].BlockState = BlockInfo.BlockState.UP;
                            }
                        }
                        else
                        {
                            if (this._numberBlocks[i].isReversed)
                            {
                                this._numberBlocks[i].BlockState = BlockInfo.BlockState.UP;
                            }
                            else
                            {
                                this._numberBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                            }
                        }
                    }
                }
                this.blocksReady = true;
                return;
            }
            if ((this._numberBlocks.Count | this._normalBlocks.Count | this._multiBlocks.Count) > 0)
            {
                GridAudio.instance.PlayMovement();
            }

            if (this._numberBlocks.Count > 0)
            {
                count = this._numberBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._numberBlocks[i].currentCounter == 1)
                    {
                        if (this._numberBlocks[i].isReversed)
                        {
                            this._numberBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                        }
                        else
                        {
                            this._numberBlocks[i].BlockState = BlockInfo.BlockState.UP;
                        }
                    }
                    else
                    {
                        if (this._numberBlocks[i].isReversed)
                        {
                            this._numberBlocks[i].BlockState = BlockInfo.BlockState.UP;
                        }
                        else
                        {
                            this._numberBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                        }
                    }
                }
            }

            if (this._normalBlocks.Count > 0)
            {
                count = this._normalBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._normalBlocks[i].FirstDirection == current)
                    {
                        if (this._normalBlocks[i].isUp)
                        {
                            continue;
                        }
                        else
                        {
                            this._normalBlocks[i].BlockState = BlockInfo.BlockState.UP;
                        }
                    }
                    else
                    {
                        if (this._normalBlocks[i].isUp)
                        {
                            this._normalBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                        }
                    }
                }
            }

            if (this._multiBlocks.Count > 0)
            {
                count = this._multiBlocks.Count;
                for (i = 0; i < count; i++)
                {
                    if (this._multiBlocks[i].BlockDirections.Contains(current))
                    {
                        if (this._multiBlocks[i].isUp)
                        {
                            this._multiBlocks[i].PreviousState = BlockInfo.BlockState.UP;
                            continue;
                        }
                        else
                        {
                            this._multiBlocks[i].BlockState = BlockInfo.BlockState.UP;
                        }
                    }
                    else
                    {
                        if (this._multiBlocks[i].isUp)
                        {
                            this._multiBlocks[i].BlockState = BlockInfo.BlockState.DOWN;
                        }
                    }
                }
            }

            this.blocksReady = true;
        }
Пример #11
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();
        }
Пример #12
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();
        }
Пример #13
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();
        }
Пример #14
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();
        }