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; // Rigidbody rb; // // private void Start() // { // rb = this.gameObject.GetComponent(); // for (int i = 0; i < clientData.AllClients.Count; i++) // { // Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)"); // } // } // // IEnumerator PushLeftCoroutine(float time) // { // float elapsedTime = 0; // Vector3 startPosition = transform.position; // Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1.0f); // time *= 0.8f; // yield return new WaitForSeconds(0.05f); // while (elapsedTime < time) // { // transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); // yield return new WaitForEndOfFrame(); // elapsedTime += Time.deltaTime; // } // transform.position = endPosition; // Destroy(gameObject); // } // IEnumerator PushRightCoroutine(float time) // { // float elapsedTime = 0; // Vector3 startPosition = transform.position; // Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1.0f); // time *= 0.8f; // yield return new WaitForSeconds(0.05f); // while (elapsedTime < time) // { // transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); // yield return new WaitForEndOfFrame(); // elapsedTime += Time.deltaTime; // } // transform.position = endPosition; // Destroy(gameObject); // } // // void OnTriggerEnter(Collider other) // { // foreach (string name in Names) // { // if (other.gameObject.name == name) // { // rb.velocity = Vector3.zero; // player = GameObject.Find(charname); // Rigidbody playerRB = player.GetComponent(); // if (shootingRight == true) // { // StartCoroutine(PushRightCoroutine(0.5f)); // player.GetComponent().CannonRMove(0.5f); // } // else // { // StartCoroutine(PushLeftCoroutine(0.5f)); // player.GetComponent().CannonLMove(0.5f); // } // } // } // } //}