using System.Collections; using System.Collections.Generic; using UnityEngine; using Networking.Client; public class CannonShot : MonoBehaviour { public bool shootingRight; public ConnectedClients clientData; GameObject player; string charname; public List Names; private void Start() { Names.Add("Character"); /*for (int i = 0; i < clientData.AllClients.Count; i++) { Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)"); }*/ } void OnTriggerEnter(Collider other) { foreach (string name in Names) { Debug.Log(name); if (other.gameObject.name == name) { charname = other.gameObject.name; Debug.Log(charname); player = GameObject.Find(charname); if (shootingRight == true) { player.GetComponent().CannonLMove(1.0f); } else { player.GetComponent().CannonLMove(1.0f); } } } } }