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.

79 lines
2.7 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Networking.Client;
  5. //public class CannonShot : MonoBehaviour
  6. //{
  7. // public bool shootingRight;
  8. // public ConnectedClients clientData;
  9. // GameObject player;
  10. // string charname;
  11. // public List<string> Names;
  12. // Rigidbody rb;
  13. //
  14. // private void Start()
  15. // {
  16. // rb = this.gameObject.GetComponent<Rigidbody>();
  17. // for (int i = 0; i < clientData.AllClients.Count; i++)
  18. // {
  19. // Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)");
  20. // }
  21. // }
  22. //
  23. // IEnumerator PushLeftCoroutine(float time)
  24. // {
  25. // float elapsedTime = 0;
  26. // Vector3 startPosition = transform.position;
  27. // Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1.0f);
  28. // time *= 0.8f;
  29. // yield return new WaitForSeconds(0.05f);
  30. // while (elapsedTime < time)
  31. // {
  32. // transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time));
  33. // yield return new WaitForEndOfFrame();
  34. // elapsedTime += Time.deltaTime;
  35. // }
  36. // transform.position = endPosition;
  37. // Destroy(gameObject);
  38. // }
  39. // IEnumerator PushRightCoroutine(float time)
  40. // {
  41. // float elapsedTime = 0;
  42. // Vector3 startPosition = transform.position;
  43. // Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1.0f);
  44. // time *= 0.8f;
  45. // yield return new WaitForSeconds(0.05f);
  46. // while (elapsedTime < time)
  47. // {
  48. // transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time));
  49. // yield return new WaitForEndOfFrame();
  50. // elapsedTime += Time.deltaTime;
  51. // }
  52. // transform.position = endPosition;
  53. // Destroy(gameObject);
  54. // }
  55. //
  56. // void OnTriggerEnter(Collider other)
  57. // {
  58. // foreach (string name in Names)
  59. // {
  60. // if (other.gameObject.name == name)
  61. // {
  62. // rb.velocity = Vector3.zero;
  63. // player = GameObject.Find(charname);
  64. // Rigidbody playerRB = player.GetComponent<Rigidbody>();
  65. // if (shootingRight == true)
  66. // {
  67. // StartCoroutine(PushRightCoroutine(0.5f));
  68. // player.GetComponent<Character>().CannonRMove(0.5f);
  69. // }
  70. // else
  71. // {
  72. // StartCoroutine(PushLeftCoroutine(0.5f));
  73. // player.GetComponent<Character>().CannonLMove(0.5f);
  74. // }
  75. // }
  76. // }
  77. // }
  78. //}