Exemplo n.º 1
0
    void AddToPortalListLogic()
    {
        for (int i = 0; i < myPathManager.GetPortals.Count; i++)
        {
            if (myPathManager.CheckPlacement(myInputCoordinates, myPathManager.GetPortals[i].myStartTile))
            {
                if (myValidPlacement[i] == true)
                {
                    PathTile path = myBuildManager.SpawnFromPool(1, Quaternion.identity, myInputCoordinates);
                    path.GetPathTilePosition = myInputCoordinates;
                    //myPathManager.GetPathTileMap[myInputCoordinates.x, myInputCoordinates.z] = path;
                    myPathManager.AddItemToPortalMap(path, i);
                    path.CheckNeighbors();
                    Debug.Log("Add item to portal list");
                    WorldController.Instance.GetWorld.SetTileState(myInputCoordinates.x, myInputCoordinates.z, Tile.TileState.road);

                    if (myBooleansPortal[i] == false)
                    {
                        myBooleansPortal[i] = true;
                    }
                }


                //isPlaceingByPortal = true;
            }
        }
    }
Exemplo n.º 2
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);
        }
    }