You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
997 B

  1. using Networking.Server;
  2. using System.Collections;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.SceneManagement;
  6. public class winnerscene : MonoBehaviour
  7. {
  8. public ClientList clientDataList;
  9. public ServerObject serverObj;
  10. public GameObject winname;
  11. public Transform characterPosition;
  12. private void Awake()
  13. {
  14. //GameObject character = Resources.Load<>
  15. GameObject prefab = Resources.Load<GameObject>(GlobalVariables.winneranimal);
  16. GameObject character = Instantiate(prefab, characterPosition);
  17. character.transform.rotation = Quaternion.Euler(0, 152.775f, 0);
  18. winname.GetComponent<TextMeshProUGUI>().text = GlobalVariables.winnername;
  19. StartCoroutine(displayforSeconds());
  20. }
  21. IEnumerator displayforSeconds()
  22. {
  23. clientDataList.server.DisconnectAllConnections();
  24. yield return new WaitForSeconds(10.0f);
  25. serverObj.ServerClose();
  26. SceneManager.LoadScene("MainMenu Server");
  27. }
  28. }