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.

31 lines
947 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 prefab = Resources.Load<GameObject>(GlobalVariables.winneranimal);
  15. GameObject character = Instantiate(prefab, characterPosition);
  16. character.transform.rotation = Quaternion.Euler(0, 152.775f, 0);
  17. winname.GetComponent<TextMeshProUGUI>().text = GlobalVariables.winnername;
  18. StartCoroutine(displayforSeconds());
  19. }
  20. IEnumerator displayforSeconds()
  21. {
  22. clientDataList.server.DisconnectAllConnections();
  23. yield return new WaitForSeconds(10.0f);
  24. serverObj.ServerClose();
  25. SceneManager.LoadScene("MainMenu Server");
  26. }
  27. }