public void CustomAwake()
        {
            sceneManager    = FindObjectOfType <SceneManager>();
            inputController = FindObjectOfType <InputController>();
            try
            {
                telloModel         = transform.Find("Tello Model");
                ground             = transform.Find("Ground");
                telloGround        = transform.Find("Tello Ground");
                flightPointsParent = GameObject.Find("Track Points").transform;
                //telloHeight = GameObject.Find("tello (Height)").transform;
            }
            catch
            {
                Debug.Log("Missing a gameObject");
            }


            if (telloVideoTexture == null)
            {
                telloVideoTexture = FindObjectOfType <TelloVideoTexture>();
            }
        }
 public void CustomStart(SceneManager sceneManager)
 {
     this.sceneManager = sceneManager;
     rigidBody         = GetComponent <Rigidbody>();
     inputController   = sceneManager.inputController;
 }
Esempio n. 3
0
        override protected void Awake()
        {
            base.Awake();
            telloManager = transform.Find("Tello Manager").GetComponent <TelloManager>();
            autoPilot    = GetComponent <TelloAutoPilot>();

            if (!telloManager)
            {
                Debug.LogError("No Tello Manager Found");
            }

            //so we can roll/pitch tello model without the camera moving on those axis
            var trackingCamObject = transform.Find("Tracking Camera (Display 2)");

            if (trackingCamObject)
            {
                display2Cam = trackingCamObject.GetComponent <Camera>();
            }
            if (sceneType != SceneType.SimOnly)
            {
                telloManager.CustomAwake();
                if (display2Cam)
                {
                    display2Cam.transform.SetParent(telloManager.transform);
                }
            }
            else
            {
                telloManager.gameObject.SetActive(false);
            }

            inputController = FindObjectOfType <InputController>();
            if (!inputController)
            {
                Debug.LogError("Missing an input controller");
            }
            else
            {
                inputController.CustomAwake(this);
            }

            //Simulator
            simulator = FindObjectOfType <DroneSimulator>();
            if (!simulator)
            {
                Debug.Log("No tello simulator found");
            }
            if (sceneType == SceneType.FlyOnly)
            {
                if (simulator)
                {
                    simulator.gameObject.SetActive(false);
                }
                activeDrone = telloManager.gameObject.transform;
            }
            else if (sceneType == SceneType.SimOnly)
            {
                Debug.Log("Begin Sim");
                activeDrone = simulator.gameObject.transform;
                display2Cam.transform.SetParent(simulator.transform);
            }
        }