Beispiel #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         other.gameObject.transform.position = destination.transform.position + destination.transform.forward;
         other.gameObject.transform.Rotate(0, 30, 0);
         UnityStandardAssets.Characters.FirstPerson.FirstPersonController fpc = other.gameObject.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
         var type = fpc.GetType();
         if (type.GetMethod("SetRotation") != null)
         {
             fpc.SetRotation(destination.transform);
         }
     }
 }
Beispiel #2
0
    public void EnableInput()
    {
        GameObject cur_fps = CurrentGameState == GameStates.Learning ?
                             FPSControllers[LearningWorldOrder[m_currFPSIndex]] : FPSControllers[TestingWorldOrder[m_currFPSIndex]];

        UnityStandardAssets.Characters.FirstPerson.FirstPersonController fpsc = (cur_fps.GetComponent <
                                                                                     UnityStandardAssets.Characters.FirstPerson.FirstPersonController>());

        //Reset the rotation ourselves because the mouselook script on the FPSC overrides it
        if (once)
        {
            fpsc.SetRotation(fpsc.transform.rotation);
        }

        fpsc.enabled = true;
        once         = true;
    }