Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     hand     = FindObjectOfType <ArrowHand>();
     notchObj = transform.GetChild(0);
     lr       = GetComponent <LineRenderer>();
     lr.SetVertexCount(51);
     nocked = null;
     src    = gameObject.AddComponent <AudioSource>();
 }
Beispiel #3
0
    //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");
            }
        }
    }