// Start the game public GameObject StartGame(Transform parentTransform, Vector3 spawnPoint, Quaternion spawnRotation, SettingsLevel settings) { // Create the character at the right spawnlocation GameObject current = Instantiate(currentCharacter, spawnPoint, spawnRotation); current.transform.parent = parentTransform; character = current.GetComponent <BasicMovement>(); // Set the name+character name settings.SetCharacter(name, currentCharacter.name); character.Settings(settings); // Set the right spawnpoint to the respawn location character.spawnPoint = spawnPoint; character.rotationPoint = spawnRotation; // Reset the menu if (menuCharacter != null) { name = menuCharacter.name; clr = menuCharacter.clr; } // Set the color of the character character.SetBasics(name, clr); // Set the right game state game = true; menu = false; // Return the current character that the controller controls return(current); }
public GameObject StartGame(Transform parentTransform, Vector3 spawnPoint, Quaternion spawnRotation, SettingsLevel settings) { GameObject behaviour = GameObject.Find("Behaviour"); GameObject current = Instantiate(currentCharacter, spawnPoint, spawnRotation); current.transform.parent = parentTransform; character = current.GetComponent <BasicMovement>(); character.spawnPoint = spawnPoint; character.rotationPoint = spawnRotation; clr = menuCharacter.clr; name = menuCharacter.name; character.SetBasics(name, clr); Debug.Log("Start with name " + name); settings.SetCharacter(name, currentCharacter.name); character.Settings(settings); return(current); }