コード例 #1
0
 // Bring in everything from the ZED Plugin
 void Start()
 {
     planeDetectionManager = FindObjectOfType(typeof(ZEDPlaneDetectionManager)) as ZEDPlaneDetectionManager;
     planeDetectionManager = planeDetectionManager.GetComponent <ZEDPlaneDetectionManager>();
     manager   = FindObjectOfType(typeof(ZEDManager)) as ZEDManager;
     zedCamera = manager.zedCamera;
 }
コード例 #2
0
 /// <summary>
 /// Awake is used to initialize any variables or game state before the game starts.
 /// </summary>
 void Awake()
 {
     canspawnbunny = false;
     tracker       = GetComponent <ZEDControllerTracker_DemoInputs>();
     zedPlane      = FindObjectOfType <ZEDPlaneDetectionManager>();
     bunnySpawner  = GetComponent <BunnySpawner>();
 }
コード例 #3
0
ファイル: Bunny.cs プロジェクト: zaherj/zed-unity
 /// <summary>
 /// Use this for initialization.
 /// Setting up the variables, and start up states.
 /// </summary>
 void Start()
 {
     //Find the left camera object if we didn't assign it at start.
     if (!_leftCamera)
     {
         _leftCamera = ZEDManager.Instance.GetLeftCameraTransform().GetComponent <Camera>();
     }
     //we're not moving at start.
     _moving = false;
     //Get our Rigidbody component.
     _rb = GetComponent <Rigidbody>();
     //Saving our initial position.
     _savedPos = transform.position;
     //Getting the ZEDPlaneDetectionManager.cs component.
     _zedPlane = FindObjectOfType <ZEDPlaneDetectionManager>();
     //If there is a child in position 2, use it as new centerPoint.
     if (transform.GetChild(2) != null)
     {
         _centerPoint = transform.GetChild(2);
     }
     else //use this transform.
     {
         _centerPoint = transform;
     }
     //Get the Animator component.
     anim = GetComponent <Animator>();
 }
コード例 #4
0
ファイル: Bunny.cs プロジェクト: jdawahare/zed-unity
    // Use this for initialization.
    void Start()
    {
        //Find the left camera object if we didn't assign it at start.
        if (!leftcamera)
        {
            leftcamera = ZEDManager.Instance.GetLeftCameraTransform().GetComponent <Camera>();
        }

        IsMoving = false; //we're not moving at start.

        //Caching
        planeManager = FindObjectOfType <ZEDPlaneDetectionManager>();
        rb           = GetComponent <Rigidbody>(); //Get our Rigidbody component.
        anim         = GetComponent <Animator>();

        InitialPosition = transform.position; //Save for calculating distance traveled later.

        //If there is a child in position 2, use it as new centerPoint.
        if (transform.GetChild(2) != null)
        {
            centerpoint = transform.GetChild(2);
        }
        else //If not, use this transform.
        {
            centerpoint = transform;
        }
    }
コード例 #5
0
 public void OnEnable()
 {
     planeDetector          = (ZEDPlaneDetectionManager)target;
     addPhysicsOption       = serializedObject.FindProperty("addPhysicsOption");
     isVisibleInSceneOption = serializedObject.FindProperty("isVisibleInSceneOption");
     isVisibleInGameOption  = serializedObject.FindProperty("isVisibleInGameOption");
     overrideMaterialOption = serializedObject.FindProperty("overrideMaterial");
 }
コード例 #6
0
 public void OnEnable()
 {
     //Assign the serialized properties to their appropriate properties.
     planeDetector          = (ZEDPlaneDetectionManager)target;
     addPhysicsOption       = serializedObject.FindProperty("addPhysicsOption");
     isVisibleInSceneOption = serializedObject.FindProperty("isVisibleInSceneOption");
     isVisibleInGameOption  = serializedObject.FindProperty("isVisibleInGameOption");
     overrideMaterialOption = serializedObject.FindProperty("overrideMaterial");
 }
コード例 #7
0
ファイル: BunnyPlacement.cs プロジェクト: zaherj/zed-unity
 /// <summary>
 /// Awake is used to initialize any variables or game state before the game starts.
 /// </summary>
 void Awake()
 {
     _canSpawnBunny = false;
     trackedObj     = GetComponent <ZEDControllerTracker>();
     zedPlane       = FindObjectOfType <ZEDPlaneDetectionManager>();
     bunnySpawner   = GetComponent <BunnySpawner>();
     if (!leftCamera)
     {
         leftCamera = ZEDManager.Instance.GetLeftCameraTransform().gameObject.GetComponent <Camera>();
     }
 }
コード例 #8
0
 // Start is called before the first frame update
 void Start()
 {
     zpdm = GetComponent <ZEDPlaneDetectionManager>();
 }
コード例 #9
0
 // Called with GameObject.SendMessage() for the menu.
 public void toggleUnknownPlanes()
 {
     zpdm = getZpdmInstance();
     zpdm.blockUnknownPlanes = !zpdm.blockUnknownPlanes;
 }
コード例 #10
0
 // Toggle from the menu UI. Needed for a GameObject.sendMessage() call.
 public void togglePlaneVisibilityInGame()
 {
     zpdm = getZpdmInstance();
     zpdm.planesVisibleInGame = !zpdm.planesVisibleInGame;
 }
コード例 #11
0
    // Get the instance of the ZEDPlaneDetectionManager component.
    // Any other objects that call a method here will not have access to the instance if assigned in Start().
    ZEDPlaneDetectionManager getZpdmInstance()
    {
        ZEDPlaneDetectionManager zpdm = FindObjectOfType(typeof(ZEDPlaneDetectionManager)) as ZEDPlaneDetectionManager;

        return(zpdm.GetComponent <ZEDPlaneDetectionManager>());
    }
コード例 #12
0
 // Start is called before the first frame update
 // Can be accessed from Update(), but not from methods called with GameObject.sendMessage()
 void Start()
 {
     zpdm = getZpdmInstance();
 }
コード例 #13
0
 private void Awake()
 {
     _manager = GetComponent <ZEDPlaneDetectionManager>();
 }