Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ReachTargetInTime reachTargetInTime = gameObject.AddComponent <ReachTargetInTime>();
         reachTargetInTime.SetInitialValue(target, reachingTime, attachToTargetWhenReached);
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (is3rdPerson && Input.GetKeyDown(KeyCode.Alpha1))
        {
            ReachTargetInTime reachTargetInTime = gameObject.AddComponent <ReachTargetInTime>();
            reachTargetInTime.SetInitialValue(firstPersonAnchor, 0.8f, true);
            Activate3rdPersonScript(false);
            is3rdPerson = false;
        }
        else if (!is3rdPerson && Input.GetKeyDown(KeyCode.Alpha3))
        {
            transform.parent = null;
            if (GetComponent <ReachTargetInTime>())
            {
                Destroy(GetComponent <ReachTargetInTime>());
            }

            ReachTargetInTime reachTargetInTime = gameObject.AddComponent <ReachTargetInTime>();
            reachTargetInTime.SetInitialValue(thirdPersonAnchor, 0.8f, false);
            Invoke("Activate3rdPersonScript", 0.8f);
            is3rdPerson = true;
        }
    }