Пример #1
0
 /// <summary>
 /// 타워 파괴 함수.
 /// </summary>
 /// <param name="cell"></param>
 public virtual void DestroyTower(CellClass cell)
 {
     cell.GetMap().SetMapData(cell.GetCellX(), cell.GetCellY(), null);
     cell.GetMap().RemoveTower(this);
     GameManager.Instance.GetPlayerInfo().Gold += Mathf.RoundToInt(mPrice * 0.5f);
     StartCoroutine(DestoryCoroutine());
 }
Пример #2
0
    /// <summary>
    /// 주변 이웃 Cell가져오기.
    /// </summary>
    /// <param name="node"></param>
    /// <returns></returns>
    public List <CellClass> GetNeighbours(CellClass node)
    {
        List <CellClass> neighbours = new List <CellClass>();

        // Left
        if (node.GetCellX() - 1 >= 0)
        {
            neighbours.Add(mMap[node.GetCellX() - 1, node.GetCellY()]);
        }
        // Right
        if (node.GetCellX() + 1 < mMapSizeX)
        {
            neighbours.Add(mMap[node.GetCellX() + 1, node.GetCellY()]);
        }
        // Up
        if (node.GetCellY() - 1 >= 0)
        {
            neighbours.Add(mMap[node.GetCellX(), node.GetCellY() - 1]);
        }
        // Down
        if (node.GetCellY() + 1 < mMapSizeY)
        {
            neighbours.Add(mMap[node.GetCellX(), node.GetCellY() + 1]);
        }

        return(neighbours);
    }