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.

38 lines
951 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Networking.Client;
  5. public class ConveyorBelt : MonoBehaviour
  6. {
  7. public ConnectedClients clientData;
  8. bool characterOnBelt = false;
  9. GameObject player;
  10. string charname;
  11. private List<string> Names;
  12. private void Start()
  13. {
  14. for (int i = 0; i < clientData.AllClients.Count; i++)
  15. {
  16. Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)");
  17. }
  18. }
  19. void OnTriggerEnter(Collider other)
  20. {
  21. for (int i = 0; i < Names.Count; i++)
  22. {
  23. if (other.gameObject.name == Names[i])
  24. {
  25. characterOnBelt = true;
  26. charname = other.gameObject.name;
  27. }
  28. }
  29. }
  30. public void Animate()
  31. {
  32. player = GameObject.Find(charname);
  33. player.GetComponent<Character>().conveyorMove(Direction.Forward, 1.0f);
  34. }
  35. }