private void Arrow_OnArrowLanded(Arrow me, string collisionName, Transform treeTeleportationTransform) { LineRenderer l = arrowLines[me]; arrowLines.Remove(me); Destroy(me.gameObject); StopAllCoroutines(); if (!EndGameDetection.endgameTriggered) { if (collisionName == "Tree") { Destroy(l.gameObject); Player.instance.transform.position = treeTeleportationTransform.position; } else { Debug.Log("line renderer destroyed"); if (ArrowHand.GetIsArrowInAir()) { ArrowHand.SetIsArrowInAir(false); } } } if (l != null) { Destroy(l.gameObject); } }
//IEnumerator ArrowTeleport(LineRenderer l, Transform arrowTip) //{ // Vector3[] pos = new Vector3[l.positionCount]; // l.GetPositions(pos); // for (int i = 0; i < pos.Length - 5; i += 5) // { // Player.instance.transform.position = l.GetPosition(i); // yield return null; // } // Player.instance.transform.position = arrowTip.position; // if (ArrowHand.GetIsArrowInAir()) // { // ArrowHand.SetIsArrowInAir(false); // Debug.Log("Arrow terminated from arrowTimeOut method"); // } //} IEnumerator ArrowTimeOut(Arrow me, LineRenderer l) { if (l != null) { yield return(new WaitForSecondsRealtime(10f)); arrowLines.Remove(me); Destroy(me); Destroy(l); if (ArrowHand.GetIsArrowInAir()) { ArrowHand.SetIsArrowInAir(false); Debug.Log("Arrow terminated from arrowTimeOut method"); } } }