Add airship level

Fix default spawn issue
TODO: Fix issue with spawning when loading from other scenes
This commit is contained in:
2022-08-30 01:48:01 -07:00
parent 82bf43452b
commit 7a891a45f1
22 changed files with 3856 additions and 316 deletions

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using UnityEngine;
public class WorldMapSpawnController : MonoBehaviour
{
[HideInInspector]
public GameObject Player;
[HideInInspector]
public Transform DefaultSpawnLocation;
[HideInInspector]
public List<Transform> SpawnLocations;
[SerializeField]
private GameObject _playerPrefab;
[SerializeField]
private Transform[] _spawnLocationsPrefabs;
[SerializeField]
private Transform _defaultSpawnLocationPrefab;
private void OnEnable()
{
Player = Instantiate(_playerPrefab);
DefaultSpawnLocation = Instantiate(_defaultSpawnLocationPrefab);
foreach (var spawnLocationPrefab in _spawnLocationsPrefabs)
SpawnLocations.Add(Instantiate(spawnLocationPrefab));
var cc = Player.GetComponent<CharacterController>();
cc.enabled = false;
Player.transform.position = DefaultSpawnLocation.position;
Player.transform.rotation = DefaultSpawnLocation.rotation;
cc.enabled = true;
}
}