34 lines
791 B
C#
34 lines
791 B
C#
using UnityEngine;
|
|
|
|
public class CharacterActivator : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform playerSpawnPoint;
|
|
|
|
private void Start()
|
|
{
|
|
SpawnSelectedCharacter();
|
|
}
|
|
|
|
private void SpawnSelectedCharacter()
|
|
{
|
|
string selectedCharacter =
|
|
SelectionOptions.Instance.playerTeam[
|
|
SelectionOptions.Instance.captainIndex
|
|
];
|
|
|
|
GameObject prefab =
|
|
CharacterPrefabManager.Instance.GetCharacterPrefab(selectedCharacter, false);
|
|
|
|
if (prefab == null)
|
|
{
|
|
Debug.LogError("Could not load selected character: " + selectedCharacter);
|
|
return;
|
|
}
|
|
|
|
Instantiate(
|
|
prefab,
|
|
playerSpawnPoint.position,
|
|
playerSpawnPoint.rotation
|
|
);
|
|
}
|
|
} |