Exemple #1
0
    /// <summary>
    /// Ajoute la tile à TileSelected. Pour le mvmt du joueur => Check egalement toutes les conditions de déplacement.
    /// </summary>
    /// <param name="tileId">Tile</param>
    public void AddMouvement(int tileId)
    {
        check = false;
        if (_isInMouvement)
        {
            if (newNeighbourId.Contains(tileId)) // Si cette case est dans la range de l'unité.
            {
                if (selectedTileId.Contains(tileId))
                {
                    // Supprime toutes les cases sélectionnées à partir de l'ID tileId.
                    for (int i = selectedTileId.IndexOf(tileId); i < selectedTileId.Count; i++)
                    {
                        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Forêt, selectedTileId[i]) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Mont, selectedTileId[i]))
                        {
                            // Redistribution du Range à chaque suppression de case.
                            if (RouteBonus)
                            {
                                RouteBonus = false;
                                if (mUnit.GetComponent <UnitScript>().MoveLeft + 1 > mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed)
                                {
                                    mUnit.GetComponent <UnitScript>().MoveSpeedBonus += 1;
                                }
                                else
                                {
                                    mUnit.GetComponent <UnitScript>().MoveLeft += 1;
                                }
                            }
                            else
                            {
                                if (mUnit.GetComponent <UnitScript>().MoveLeft + 2 > mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed)
                                {
                                    int moveToAdd = 2 - (mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed - mUnit.GetComponent <UnitScript>().MoveLeft);
                                    mUnit.GetComponent <UnitScript>().MoveLeft        = mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed;
                                    mUnit.GetComponent <UnitScript>().MoveSpeedBonus += moveToAdd;
                                }
                                else
                                {
                                    mUnit.GetComponent <UnitScript>().MoveLeft += 2;
                                }
                            }

                            temp.Add(selectedTileId[i]);
                            TilesManager.Instance.TileList[selectedTileId[i]].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite); // Repasse les sprites en apparence "séléctionnable".
                            // Déselectionne les cases. hxh

                            TilesManager.Instance.TileList[selectedTileId[i]].GetComponent <TileScript>().DesActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveArrow);
                        }
                        else
                        {
                            // Redistribution du Range à chaque suppression de case.
                            if (mUnit.GetComponent <UnitScript>().MoveLeft + 1 > mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed)
                            {
                                int moveToAdd = 1 - (mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed - mUnit.GetComponent <UnitScript>().MoveLeft);
                                mUnit.GetComponent <UnitScript>().MoveLeft        = mUnit.GetComponent <UnitScript>().UnitSO.MoveSpeed;
                                mUnit.GetComponent <UnitScript>().MoveSpeedBonus += moveToAdd;
                            }
                            else
                            {
                                if (RouteBonus)
                                {
                                    RouteBonus = false;
                                }
                                else
                                {
                                    mUnit.GetComponent <UnitScript>().MoveLeft += 1;
                                }
                            }

                            temp.Add(selectedTileId[i]);
                            TilesManager.Instance.TileList[selectedTileId[i]].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite); // Repasse les sprites en apparence "séléctionnable".
                        }
                    }
                    foreach (int i in temp)
                    {
                        selectedTileId.Remove(i);
                    }
                    temp.Clear();

                    Attaque.Instance.RemoveTileSprite();
                    Attaque.Instance.StartAttackSelectionUnit(selectedTileId[selectedTileId.Count - 1]);
                }  // Si cette case est déjà selectionnée.
                else if (PlayerStatic.IsNeighbour(tileId, selectedTileId[selectedTileId.Count - 1], TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().Line, false))
                {
                    // et qu'il reste du mvmt, on assigne la nouvelle case selectionnée à la liste SelectedTile.
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Est, tileId) && PlayerStatic.CheckDirection(tileId, selectedTileId[selectedTileId.Count - 1]) == MYthsAndSteel_Enum.Direction.Est && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Est, tileId))
                    {
                        check = true;
                    }
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Nord, tileId) && PlayerStatic.CheckDirection(tileId, selectedTileId[selectedTileId.Count - 1]) == MYthsAndSteel_Enum.Direction.Nord && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Nord, tileId))
                    {
                        check = true;
                    }
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Sud, tileId) && PlayerStatic.CheckDirection(tileId, selectedTileId[selectedTileId.Count - 1]) == MYthsAndSteel_Enum.Direction.Sud && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Sud, tileId))
                    {
                        check = true;
                    }
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Ouest, tileId) && PlayerStatic.CheckDirection(tileId, selectedTileId[selectedTileId.Count - 1]) == MYthsAndSteel_Enum.Direction.Ouest && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Ouest, tileId))
                    {
                        check = true;
                    }
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Forêt, tileId) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Mont, tileId))
                    {
                        if (mUnit.GetComponent <UnitScript>().MoveLeft >= 2 && !check)
                        {
                            check = true;
                            mUnit.GetComponent <UnitScript>().MoveLeft -= 2; // sup 2 mvmt.
                            selectedTileId.Add(tileId);
                            TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _tileSprite);

                            Attaque.Instance.RemoveTileSprite();
                            Attaque.Instance.StartAttackSelectionUnit(tileId);
                        }
                        else if (mUnit.GetComponent <UnitScript>().MoveLeft + mUnit.GetComponent <UnitScript>().MoveSpeedBonus >= 2 && !check)
                        {
                            int moveToDecrease = 2;
                            moveToDecrease -= mUnit.GetComponent <UnitScript>().MoveLeft;
                            mUnit.GetComponent <UnitScript>().MoveLeft        = 0;
                            mUnit.GetComponent <UnitScript>().MoveSpeedBonus -= moveToDecrease;
                        }
                        else if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Route, selectedTileId[selectedTileId.Count - 1]) && (mUnit.GetComponent <UnitScript>().MoveLeft + mUnit.GetComponent <UnitScript>().MoveSpeedBonus) == 1 && !RouteBonus && !check)
                        {
                            RouteBonus = true;
                            check      = true;
                            if (mUnit.GetComponent <UnitScript>().MoveLeft > 0)
                            {
                                mUnit.GetComponent <UnitScript>().MoveLeft--;
                            }
                            else
                            {
                                mUnit.GetComponent <UnitScript>().MoveSpeedBonus--;
                            }
                            selectedTileId.Add(tileId);
                            TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _tileSprite);

                            Attaque.Instance.RemoveTileSprite();
                            Attaque.Instance.StartAttackSelectionUnit(tileId);
                        }
                        else
                        {
                            check = true;
                            Debug.Log("La tile d'ID : " + tileId + " est une foret ou un mont.");
                        }
                    }
                    if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Route, selectedTileId[selectedTileId.Count - 1]) && (mUnit.GetComponent <UnitScript>().MoveLeft + mUnit.GetComponent <UnitScript>().MoveSpeedBonus) == 0 && !RouteBonus)
                    {
                        RouteBonus = true;
                        check      = true;
                        selectedTileId.Add(tileId);
                        TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _tileSprite);
                        Attaque.Instance.RemoveTileSprite();
                        Attaque.Instance.StartAttackSelectionUnit(tileId);
                    }
                    if (!check)
                    {
                        if (mUnit.GetComponent <UnitScript>().MoveLeft > 0)
                        {
                            mUnit.GetComponent <UnitScript>().MoveLeft--; // sup 1 mvmt.
                            selectedTileId.Add(tileId);
                            TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _tileSprite);

                            Attaque.Instance.RemoveTileSprite();
                            Attaque.Instance.StartAttackSelectionUnit(tileId);
                        }
                        else if (mUnit.GetComponent <UnitScript>().MoveSpeedBonus > 0)
                        {
                            mUnit.GetComponent <UnitScript>().MoveSpeedBonus--; // sup 1 mvmt.
                            selectedTileId.Add(tileId);
                            TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _tileSprite);

                            Attaque.Instance.RemoveTileSprite();
                            Attaque.Instance.StartAttackSelectionUnit(tileId);
                        }
                    }
                }    // Sinon, si cette case est bien voisine de l'ancienne selection.
                else // Sinon cette case est trop loin de l'ancienne seletion.
                {
                    Debug.Log("La tile d'ID : " + tileId + " est trop loin de la tile d'ID: " + selectedTileId[selectedTileId.Count - 1]);
                }
            }
            // Sinon cette case est hors de la range de l'unité.
            else
            {
                Debug.Log("La tile d'ID : " + tileId + " est trop loin de la tile d'ID: " + selectedTileId[selectedTileId.Count - 1]);
            }
        }
        if (selectedTileId.Count > 1 && TilesManager.Instance.TileList[selectedTileId[selectedTileId.Count - 1]].GetComponent <TileScript>().Unit == null)
        {
            UIInstance.Instance.ActivationUnitPanel.ShowMovementPanel();
        }
        else
        {
            UIInstance.Instance.ActivationUnitPanel.CloseMovementPanel();
        }
        //DisplayMoveArrow();
    }
Exemple #2
0
    /// <summary>
    /// Change les stats en fonction de où se trouve l'unité
    /// </summary>
    public void ChangeStat()
    {
        // Applique les bonus/malus de terrains
        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Bosquet, _selectedUnit.GetComponent <UnitScript>().ActualTiledId)) // Bosquet
        {
            _numberRangeMin.x -= 1;
            _numberRangeMin.y -= 1;
            _numberRangeMax.x -= 1;
            Debug.Log("BosquetEffectApplyed");
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Colline, _selectedUnit.GetComponent <UnitScript>().ActualTiledId)) // Colline
        {
            _selectedUnit.GetComponent <UnitScript>().AttackRangeBonus += 1;
            Debug.Log("CollineEffectApplyed");
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Plage, _selectedUnit.GetComponent <UnitScript>().ActualTiledId) && _selectedUnit.GetComponent <Unit_SO>().typeUnite == MYthsAndSteel_Enum.TypeUnite.Infanterie) // Plage
        {
            _numberRangeMin.x += -2;
            _numberRangeMin.y += -1;
            _numberRangeMax.x += -1;
            Debug.Log("PlayaEffectApplyed");
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Haute_colline, _selectedUnit.GetComponent <UnitScript>().ActualTiledId)) // Haute colline 1
        {
            _selectedUnit.GetComponent <UnitScript>().AttackRangeBonus = 1;
            Debug.Log("Haute collineEffectApplyed");
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Haute_colline, selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId)) // Haute colline 2
        {
            if (!PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Colline, _selectedUnit.GetComponent <UnitScript>().ActualTiledId) || !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Haute_colline, _selectedUnit.GetComponent <UnitScript>().ActualTiledId))
            {
                _numberRangeMin.x += 2;
                _numberRangeMin.y += 2;
                _numberRangeMax.x += 2;
                Debug.Log("HautecollinesamerelapEffectApplyed");
            }
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Maison, selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId)) // Maison
        {
            _damageMinimum -= 1;
            _damageMaximum -= 1;
            Debug.Log("Dégats Reduits");
            TilesManager.Instance.TileList[selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId].GetComponent <TileScript>().TerrainEffectList.Remove(MYthsAndSteel_Enum.TerrainType.Maison);
            TilesManager.Instance.TileList[selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId].GetComponent <TileScript>().TerrainEffectList.Add(MYthsAndSteel_Enum.TerrainType.Ruines);
            Debug.Log("IkeaEffectApplyed");
        }

        if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Immeuble, selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId)) // Immeubles
        {
            _damageMinimum = 0;
            _damageMaximum = 0;
            Debug.Log("Annulés");
            TilesManager.Instance.TileList[selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId].GetComponent <TileScript>().TerrainEffectList.Remove(MYthsAndSteel_Enum.TerrainType.Immeuble);
            TilesManager.Instance.TileList[selectedUnitEnnemy.GetComponent <UnitScript>().ActualTiledId].GetComponent <TileScript>().TerrainEffectList.Add(MYthsAndSteel_Enum.TerrainType.Ruines);
            Debug.Log("BigBoumIkeaEffectApplyed");
        }
    }
Exemple #3
0
 /// <summary>
 /// Cette fonction "highlight" les cases atteignables par l'unité sur la case sélectionnée.
 /// </summary>
 /// <param name="tileId">Tile centrale</param>
 /// <param name="Range">Range de l'unité</param>
 public void Highlight(int tileId, int Range, int lasttileId)
 {
     if (Range > 0)
     {
         foreach (int ID in PlayerStatic.GetNeighbourDiag(tileId, TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().Line, false))
         {
             if (ID == lasttileId)
             {
                 continue;
             }
             TileScript TileSc = TilesManager.Instance.TileList[ID].GetComponent <TileScript>();
             bool       i      = false;
             if (GameManager.Instance.IsPlayerRedTurn)
             {
                 if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit != null)
                 {
                     if (!TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit.GetComponent <UnitScript>().UnitSO.IsInRedArmy)
                     {
                         i = true;
                     }
                     if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit.GetComponent <UnitScript>().UnitSO.IsInRedArmy&& Range == 1)
                     {
                         i = true;
                     }
                 }
             }
             if (!GameManager.Instance.IsPlayerRedTurn)
             {
                 if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit != null)
                 {
                     if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit.GetComponent <UnitScript>().UnitSO.IsInRedArmy)
                     {
                         i = true;
                     }
                     if (!TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit.GetComponent <UnitScript>().UnitSO.IsInRedArmy&& Range == 1)
                     {
                         i = true;
                     }
                 }
             }
             foreach (MYthsAndSteel_Enum.TerrainType Type in TileSc.TerrainEffectList)
             {
                 if (EffectToCheck.Contains(Type))
                 {
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Ravin, ID) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Eau, ID))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Est, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Est && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Est, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Nord, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Nord && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Nord, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Sud, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Sud && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Sud, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Ouest, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Ouest && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Ouest, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Mont, ID) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Forêt, ID))
                     {
                         if (Range >= 2 && !i)
                         {
                             i = true;
                             TilesManager.Instance.TileList[ID].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite);
                             if (!newNeighbourId.Contains(ID))
                             {
                                 newNeighbourId.Add(ID);
                             }
                             Highlight(ID, Range - 2, tileId);
                             break;
                         }
                         else
                         {
                             i = true;
                             break;
                         }
                     }
                 }
             }
             if (!i)
             {
                 TilesManager.Instance.TileList[ID].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite);
                 if (!newNeighbourId.Contains(ID))
                 {
                     newNeighbourId.Add(ID);
                 }
                 Highlight(ID, Range - 1, tileId);
             }
         }
     }
     // Si il s'agit d'une route et que la range est de 0.
     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Route, tileId) && Range == 0)
     {
         foreach (int ID in PlayerStatic.GetNeighbourDiag(tileId, TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().Line, false))
         {
             if (ID == lasttileId)
             {
                 continue;
             }
             TileScript TileSc = TilesManager.Instance.TileList[ID].GetComponent <TileScript>();
             bool       i      = false;
             if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit != null)
             {
                 i = true;
             }
             foreach (MYthsAndSteel_Enum.TerrainType Type in TileSc.TerrainEffectList)
             {
                 if (EffectToCheck.Contains(Type))
                 {
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Ravin, ID) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Eau, ID))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Est, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Est && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Est, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Nord, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Nord && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Nord, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Sud, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Sud && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Sud, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Ouest, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Ouest && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Ouest, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Mont, ID) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Forêt, ID))
                     {
                         i = true;
                     }
                 }
             }
             if (!i)
             {
                 TilesManager.Instance.TileList[ID].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite);
                 if (!newNeighbourId.Contains(ID))
                 {
                     newNeighbourId.Add(ID);
                 }
                 Highlight(ID, -1, tileId);
             }
         }
     }
     // Si il s'agit d'une route et que la range est de 1.
     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Route, tileId) && Range == 1)
     {
         foreach (int ID in PlayerStatic.GetNeighbourDiag(tileId, TilesManager.Instance.TileList[tileId].GetComponent <TileScript>().Line, false))
         {
             if (ID == lasttileId)
             {
                 continue;
             }
             TileScript TileSc = TilesManager.Instance.TileList[ID].GetComponent <TileScript>();
             bool       i      = false;
             if (TilesManager.Instance.TileList[ID].GetComponent <TileScript>().Unit != null)
             {
                 i = true;
             }
             foreach (MYthsAndSteel_Enum.TerrainType Type in TileSc.TerrainEffectList)
             {
                 if (EffectToCheck.Contains(Type))
                 {
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Ravin, ID) || PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Eau, ID))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Est, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Est && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Est, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Nord, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Nord && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Nord, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Sud, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Sud && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Sud, tileId))
                     {
                         i = true;
                         break;
                     }
                     if (PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Rivière_Ouest, tileId) && PlayerStatic.CheckDirection(tileId, ID) == MYthsAndSteel_Enum.Direction.Ouest && !PlayerStatic.CheckTiles(MYthsAndSteel_Enum.TerrainType.Pont_Ouest, tileId))
                     {
                         i = true;
                         break;
                     }
                 }
             }
             if (!i)
             {
                 TilesManager.Instance.TileList[ID].GetComponent <TileScript>().ActiveChildObj(MYthsAndSteel_Enum.ChildTileType.MoveSelect, _selectedSprite);
                 if (!newNeighbourId.Contains(ID))
                 {
                     newNeighbourId.Add(ID);
                 }
                 Highlight(ID, -1, lasttileId);
             }
         }
     }
 }