Пример #1
0
    void PlacementLogic()
    {
        for (int i = 0; i < myBooleansPortal.Count; i++)
        {
            if (myBooleansPortal[i] == false)
            {
                AddToPortalListLogic();
            }
        }


        if (myPathManager.CheckPlacement(myInputCoordinates, myPathManager.GetLastPlacedTile))
        {
            PathTile path = myBuildManager.SpawnFromPool(1, Quaternion.identity, myInputCoordinates);
            path.GetPathTilePosition = myInputCoordinates;

            if (myBooleansPortal.Count > 0)
            {
                for (int i = 0; i < myBooleansPortal.Count; i++)
                {
                    if (myBooleansPortal[i] == true)
                    {
                        myPathManager.AddItemToPortalMap(path, i);
                        path.CheckNeighbors();
                    }
                    else
                    {
                        myPathManager.AddItemToMap(path);
                    }
                    path.CheckNeighbors();

                    WorldController.Instance.GetWorld.SetTileState(myInputCoordinates.x, myInputCoordinates.z, Tile.TileState.road);
                }
            }
            else
            {
                myPathManager.AddItemToMap(path);
            }
            path.CheckNeighbors();

            WorldController.Instance.GetWorld.SetTileState(myInputCoordinates.x, myInputCoordinates.z, Tile.TileState.road);
        }
    }