Example #1
0
    public void SetTileLinks()
    {
        if (!m_IsWalkable && !m_IsActivable)
        {
            I_Tile northTile     = GetNeighbour(E_Direction.North);
            I_Tile southTile     = GetNeighbour(E_Direction.South);
            I_Tile eastTile      = GetNeighbour(E_Direction.East);
            I_Tile westTile      = GetNeighbour(E_Direction.West);
            I_Tile northEastTile = GetNeighbour(E_Direction.NorthEast);
            I_Tile northWestTile = GetNeighbour(E_Direction.NorthWest);
            I_Tile southEastTile = GetNeighbour(E_Direction.SouthEast);
            I_Tile southWestTile = GetNeighbour(E_Direction.SouthWest);

            bool isNorthWalkable     = northTile != null && northTile.IsWalkable();
            bool isSouthWalkable     = southTile != null && southTile.IsWalkable();
            bool isEastWalkable      = eastTile != null && eastTile.IsWalkable();
            bool isWestWalkable      = westTile != null && westTile.IsWalkable();
            bool isNorthEastWalkable = northEastTile != null && northEastTile.IsWalkable();
            bool isNorthWestWalkable = northWestTile != null && northWestTile.IsWalkable();
            bool isSouthEastWalkable = southEastTile != null && southEastTile.IsWalkable();
            bool isSouthWestWalkable = southWestTile != null && southWestTile.IsWalkable();

            m_NorthIfIsWalkable.SetActive(isNorthWalkable);
            m_SouthIfIsWalkable.SetActive(isSouthWalkable);
            m_EastIfIsWalkable.SetActive(isEastWalkable);
            m_WestIfIsWalkable.SetActive(isWestWalkable);

            m_NorthEastIfIsWalkable.SetActive(isNorthEastWalkable && isNorthWalkable && isEastWalkable);
            m_NorthWestIfIsWalkable.SetActive(isNorthWestWalkable && isNorthWalkable && isWestWalkable);
            m_SouthEastIfIsWalkable.SetActive(isSouthEastWalkable && isSouthWalkable && isEastWalkable);
            m_SouthWestIfIsWalkable.SetActive(isSouthWestWalkable && isSouthWalkable && isWestWalkable);

            m_NorthIsNotWalkableButEastAndNorthEastAre.SetActive(!isNorthWalkable && isEastWalkable && isNorthEastWalkable);
            m_NorthIsNotWalkableButWestAndNorthWestAre.SetActive(!isNorthWalkable && isWestWalkable && isNorthWestWalkable);
            m_SouthIsNotWalkableButEastAndSouthEastAre.SetActive(!isSouthWalkable && isEastWalkable && isSouthEastWalkable);
            m_SouthIsNotWalkableButWestAndSouthWestAre.SetActive(!isSouthWalkable && isWestWalkable && isSouthWestWalkable);
            m_EastIsNotWalkableButNorthAndNorthEastAre.SetActive(!isEastWalkable && isNorthWalkable && isNorthEastWalkable);
            m_EastIsNotWalkableButSouthAndSouthEastAre.SetActive(!isEastWalkable && isSouthWalkable && isSouthEastWalkable);
            m_WestIsNotWalkableButNorthAndNorthWestAre.SetActive(!isWestWalkable && isNorthWalkable && isNorthWestWalkable);
            m_WestIsNotWalkableButSouthAndSouthWestAre.SetActive(!isWestWalkable && isSouthWalkable && isSouthWestWalkable);

            m_NorthEastIsNotWalkableButNorthIs.SetActive(!isNorthEastWalkable && isNorthWalkable);
            m_NorthEastIsNotWalkableButEastIs.SetActive(!isNorthEastWalkable && isEastWalkable);
            m_NorthWestIsNotWalkableButNorthIs.SetActive(!isNorthWestWalkable && isNorthWalkable);
            m_NorthWestIsNotWalkableButWestIs.SetActive(!isNorthWestWalkable && isWestWalkable);
            m_SouthEastIsNotWalkableButSouthIs.SetActive(!isSouthEastWalkable && isSouthWalkable);
            m_SouthEastIsNotWalkableButEastIs.SetActive(!isSouthEastWalkable && isEastWalkable);
            m_SouthWestIsNotWalkableButSouthIs.SetActive(!isSouthWestWalkable && isSouthWalkable);
            m_SouthWestIsNotWalkableButWestIs.SetActive(!isSouthWestWalkable && isWestWalkable);
        }
    }
 public override bool CanBeOnTile(I_Tile _Tile)
 {
     return(_Tile.IsWalkable() && _Tile.GetUnit() == null);
 }
 public override bool CanBeOnTile(I_Tile _Tile)
 {
     return(_Tile.IsWalkable());
 }