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.
 
 
 
 
 
 

66 lines
1.6 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Client;
using Networking.Server;
public class ConveyorBelt : MonoBehaviour
{
public ClientList clientData;
bool characterOnBelt = false;
GameObject player;
string charname;
public List<string> Names = new List<string>();
public bool left;
public bool forward;
public bool triggeranimate;
private void Start()
{
for (int i = 0; i < clientData.ConnectedClients.Count; i++)
{
Names.Add(clientData.ConnectedClients[i].characterAnimal + "(Clone)");
}
}
private void Update()
{
}
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<Character>().conveyorMoveForward(Direction.Forward, 1.0f);
}
else if (forward == false)
{
player.GetComponent<Character>().conveyorMoveBackward(Direction.Back, 1.0f);
}
if (left == true)
{
player.GetComponent<Character>().conveyorMoveLeft(Direction.Left, 1.0f);
}
else if (left == false)
{
player.GetComponent<Character>().conveyorMoveRight(Direction.Right, 1.0f);
}
}
}