public void Teleport(LocationSO where, PathSO whichEntrance) { //Avoid reloading the same Location, which would result in an error if (where == _lastLocationTeleportedTo) { return; } _path.lastPathTaken = whichEntrance; _lastLocationTeleportedTo = where; _loadLocationRequest.RaiseEvent(where); }
private int FindSpawnIndex(PathSO pathTaken) { if (pathTaken == null) { return(_defaultSpawnIndex); } int index = Array.FindIndex(_spawnLocations, element => element?.GetComponent <LocationEntrance>()?.EntrancePath == pathTaken ); return((index < 0) ? _defaultSpawnIndex : index); }
private int FindSpawnIndex(PathSO pathSoTaken) { if (pathTaken == null) { return(defaultSpawnIndex); } int index = Array.FindIndex(m_SpawnLocations, element => // ReSharper disable once Unity.NoNullPropagation element?.GetComponent <LocationEntrance>()?.EntrancePath == pathSoTaken ); return((index < 0) ? defaultSpawnIndex : index); }
public void SpawnPlayer() { _spawnPoints = FindObjectsOfType <LocationEntrance>(); LocationEntrance spawnPoint = _defaultSpawnPoint; PathSO pathTaken = _pathTakenManagerAnchor.GetReference().GetPathTaken(); if (pathTaken != null) { foreach (LocationEntrance anEntrance in _spawnPoints) { if (anEntrance.EntrancePath == pathTaken) { spawnPoint = anEntrance; } } } Spawn(spawnPoint); }
public void OnDisable() { _Path = null; isSet = false; }
public void SetPathTaken(PathSO pathTaken) { _pathTaken = pathTaken; }