public void AddItemToPortalMap(PathTile aPathTileToAdd, int index) { Debug.Log(index); int x = Mathf.FloorToInt(aPathTileToAdd.GetPathTilePosition.x); int z = Mathf.FloorToInt(aPathTileToAdd.GetPathTilePosition.z); myPathTiles[x, z] = aPathTileToAdd; myPortals[index].AddVectorToMovementList(aPathTileToAdd); myPlacementEffects.transform.position = aPathTileToAdd.transform.position; myPlacementEffects.CheckPlacementIndicators(); }
public void CheckForPortal() { myCheckForPortal = Physics.BoxCast(gameObject.transform.position, transform.localScale / 2, transform.up, out myPortalHit, Quaternion.identity, 1f, myPortalMask); if (myCheckForPortal == true) { PathManager pathManager = FindObjectOfType <PathManager>(); List <Portals> portals = pathManager.GetPortals; for (int i = 0; i < portals.Count; i++) { if (portals[i].name == myPortalHit.collider.gameObject.name) { myPlacement = FindObjectOfType <Placement>(); myPlacement.SetValidPlacement(i); myPlacementIndicator = FindObjectOfType <PlacementIndicator>(); myPlacementIndicator.transform.position = portals[i].GetExit() + gameObject.transform.position; myPlacementIndicator.CheckPlacementIndicators(); break; } } } }