public override void StateUpdate() { Vector3 targetPos = _grid.GetWorldPos(_path[_pathIndex]); if (_pathIndex == _path.Length - 1) { targetPos = _grid.GetWorldPos(_toPos);; } if (Vector3.Distance(_player.transform.position, targetPos) < 0.1f) { if (_pathIndex == _path.Length - 1) { _player.moveState = new OnLocationState(GameSession.Instance.sessionData.MissionProgression.GetMissionAt(_toPos)); return; } _pathIndex++; } _player.transform.position = Vector3.MoveTowards(_player.transform.position, targetPos, _player.travelSpeed * Time.deltaTime); }
// Start is called before the first frame update void Start() { moveState = new OnLocationState(GameSession.Instance.sessionData.MissionProgression.GetMissionAt(PlayerPos)); MissionSelectionManager.Instance.player = this; transform.position = _grid.GetWorldPos(PlayerPos); }