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.
 
 
 
 
 
 

45 lines
1.1 KiB

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<string> 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<Character>().CannonLMove(1.0f);
}
else
{
player.GetComponent<Character>().CannonLMove(1.0f);
}
}
}
}
}