예제 #1
0
        void Update()
        {
            if ((lManage != null) && (!BlockTypeIsSolid(lManage.ReturnAdjacentUp(bData))))
            {
                currTimer -= Time.deltaTime;

                if (currTimer <= 0)
                {
                    currTimer = checkDelay;

                    if ((lManage.ReturnAdjacentRight(bData) == BLOCK_WATER) ||
                        (lManage.ReturnAdjacentLeft(bData) == BLOCK_WATER) ||
                        (lManage.ReturnAdjacentForward(bData) == BLOCK_WATER) ||
                        (lManage.ReturnAdjacentBack(bData) == BLOCK_WATER))
                    {
                        lManage.ReplaceBlock(bData, fertilizedForm);
                    }

                    if ((lManage.ReturnAdjacentRight(bData) == BLOCK_GRASS) ||
                        (lManage.ReturnAdjacentLeft(bData) == BLOCK_GRASS) ||
                        (lManage.ReturnAdjacentForward(bData) == BLOCK_GRASS) ||
                        (lManage.ReturnAdjacentBack(bData) == BLOCK_GRASS))
                    {
                        lManage.ReplaceBlock(bData, fertilizedForm);
                    }
                }
            }
        }
예제 #2
0
        void Update()
        {
            currTimer -= Time.deltaTime;

            if (currTimer <= 0)
            {
                currTimer = flowDelay;

                if (lManage.ReturnAdjacentDown(bData) == BLOCK_NULL)
                {
                    lManage.CreateBlock(new GridPos(bData.blockPos.x, bData.blockPos.y - 1, bData.blockPos.z), bData.blockID);
                }
                else
                {
                    if (lManage.ReturnAdjacentDown(bData) != bData.blockID)
                    {
                        if (lManage.ReturnAdjacentLeft(bData) == BLOCK_NULL)
                        {
                            lManage.CreateBlock(new GridPos(bData.blockPos.x - 1, bData.blockPos.y, bData.blockPos.z), bData.blockID);
                        }
                        if (lManage.ReturnAdjacentRight(bData) == BLOCK_NULL)
                        {
                            lManage.CreateBlock(new GridPos(bData.blockPos.x + 1, bData.blockPos.y, bData.blockPos.z), bData.blockID);
                        }
                        if (lManage.ReturnAdjacentForward(bData) == BLOCK_NULL)
                        {
                            lManage.CreateBlock(new GridPos(bData.blockPos.x, bData.blockPos.y, bData.blockPos.z + 1), bData.blockID);
                        }
                        if (lManage.ReturnAdjacentBack(bData) == BLOCK_NULL)
                        {
                            lManage.CreateBlock(new GridPos(bData.blockPos.x, bData.blockPos.y, bData.blockPos.z - 1), bData.blockID);
                        }
                    }
                }
            }
        }