using System.Collections; using System.Collections.Generic; using UnityEngine; using Networking.Client; public class ConveyorBelt : MonoBehaviour { public ConnectedClients clientData; bool characterOnBelt = false; GameObject player; string charname = "Character"; private List Names; public bool left; public bool forward; public bool triggeranimate; private void Update() { //for testing purposes if (triggeranimate == true) { Animate(); triggeranimate = false; } } private void Start() { for (int i = 0; i < clientData.AllClients.Count; i++) { Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)"); } } void OnTriggerEnter(Collider other) { for (int i = 0; i < Names.Count; i++) { if (other.gameObject.name == Names[i]) { characterOnBelt = true; charname = other.gameObject.name; } } } public void Animate() { player = GameObject.Find(charname); if(forward == true) { player.GetComponent().conveyorMoveForward(Direction.Forward, 1.0f); } else if (forward == false) { player.GetComponent().conveyorMoveBackward(Direction.Forward, 1.0f); } else if (left == true) { player.GetComponent().conveyorMoveLeft(Direction.Forward, 1.0f); } else if (left == false) { player.GetComponent().conveyorMoveRight(Direction.Forward, 1.0f); } } }