Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 5
0
 public void OnDisable()
 {
     _Path = null;
     isSet = false;
 }
 public void SetPathTaken(PathSO pathTaken)
 {
     _pathTaken = pathTaken;
 }