Exemplo n.º 1
0
    public void IntegrateNewBlock(TempleWallBlock newBlock, WallBlockType blockType, WallBlockPosition wallPos)
    {
        Transform oldBlockTransform = GetBlockTransform(wallPos);

        CodeTools.CopyTransform(oldBlockTransform, newBlock.transform, true, true, false);

        DisableBlock(wallPos);

        AssignBlockToPosition(newBlock, wallPos);
    }
Exemplo n.º 2
0
    public int BlockCount(WallBlockType blockType)
    {
        int toReturn = 0;

        toReturn += frontWall.BlockCount(blockType);
        toReturn += backWall.BlockCount(blockType);
        toReturn += leftWall.BlockCount(blockType);
        toReturn += rightWall.BlockCount(blockType);

        return(toReturn);
    }
Exemplo n.º 3
0
 public bool DoesItFit(WallBlockType blockType, TempleWall wall, WallBlockPosition blockPos)
 {
     if (wall.GetBlockAtPosition(blockPos).blockType == WallBlockType.Block)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
    private GameObject WallBlockGO(WallBlockType b, TempleWall wall, WallBlockPosition pos)
    {
        switch (b)
        {
        case WallBlockType.Alcove:
            if (TempleWall.PositionIsTop(pos))
            {
                return(alcovePrefab_top);
            }
            else if (TempleWall.PositionIsMiddle(pos))
            {
                return(alcovePrefab_middle);
            }
            else if (TempleWall.PositionIsBottom(pos))
            {
                return(alcovePrefab_bottom);
            }
            else
            {
                Debug.LogError("Invalid wall position, apparently.");
                return(null);
            }


        case WallBlockType.ArrowTrap:
            if (TempleWall.PositionIsTop(pos))
            {
                if (gameplayManager.DEBUG_angledTopArrow)
                {
                    return(arrowTrapPrefab_topAngled);
                }
                else
                {
                    return(arrowTrapPrefab_top);
                }
            }
            else if (TempleWall.PositionIsMiddle(pos))
            {
                return(arrowTrapPrefab_middle);
            }
            else if (TempleWall.PositionIsBottom(pos))
            {
                return(arrowTrapPrefab_bottom);
            }
            else
            {
                Debug.LogError("Invalid wall position, apparently.");
                return(null);
            }
        }

        return(null);
    }
Exemplo n.º 5
0
    public int BlockCount(WallBlockType blockType)
    {
        int toReturn = 0;

        if (topLeft.blockType == blockType)
        {
            toReturn++;
        }
        if (topCenter.blockType == blockType)
        {
            toReturn++;
        }
        if (topRight.blockType == blockType)
        {
            toReturn++;
        }

        if (middleLeft.blockType == blockType)
        {
            toReturn++;
        }
        if (middleCenter.blockType == blockType)
        {
            toReturn++;
        }
        if (middleRight.blockType == blockType)
        {
            toReturn++;
        }

        if (bottomLeft.blockType == blockType)
        {
            toReturn++;
        }
        if (bottomCenter.blockType == blockType)
        {
            toReturn++;
        }
        if (bottomRight.blockType == blockType)
        {
            toReturn++;
        }

        return(toReturn);
    }
Exemplo n.º 6
0
    public void SpawnBlock(WallBlockType blockType, TempleWall wall, WallBlockPosition wallPos)
    {
        // fetch the GO prefab using the enum
        GameObject toSpawn = WallBlockGO(blockType, wall, wallPos);

        GameObject newBlockGO = (GameObject)Instantiate(toSpawn) as GameObject;

        newBlockGO.transform.parent = wall.transform;
        TempleWallBlock newBlock = newBlockGO.GetComponent <TempleWallBlock>();

        newBlock.blockPosition = wallPos;

        // this happens automatically assuming the new block gets parented under "Environment" so, not necessary
//        if (transform.localScale != Vector3.one)
//           newBlock.ScaleSelf(transform.localScale);

        newBlockGO.transform.localScale = Vector3.Scale(newBlockGO.transform.localScale, transform.localScale);


        wall.IntegrateNewBlock(newBlock, blockType, wallPos);
    }
Exemplo n.º 7
0
 public bool DoesItFit(WallBlockType blockType, RelativeDirection wallDir, WallBlockPosition blockPos)
 {
     return(DoesItFit(blockType, GetWallAtDirection(wallDir), blockPos));
 }
Exemplo n.º 8
0
 public void SpawnBlock(WallBlockType blockType, RelativeDirection wallDir, WallBlockPosition wallPos)
 {
     SpawnBlock(blockType, GetWallAtDirection(wallDir), wallPos);
 }