예제 #1
0
        //check for mouse input
        void Update()
        {
            RaycastHit hit;

            //on left mouse button down
            if (Input.GetMouseButtonDown(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                //the mouse ray has hit a collider in the scene
                if (Physics.Raycast(ray, out hit))
                {
                    //reposition pointer object to the hit point
                    pointerObj.transform.position = hit.point;

                    //construct path:
                    //starting at the current gameobject position
                    //ending at the position of the pointer object
                    path = PortalManager.GetPath(transform.position, pointerObj.transform.position);

                    //stop existing movement routines
                    StopAllCoroutines();
                    //start new agent movement to the destination
                    StartCoroutine(GoToDestination());
                }
            }
        }
예제 #2
0
 void OnEnable()
 {
     script = (PortalManager)target;
 }
예제 #3
0
 //initializes the portal tree
 void Awake()
 {
     instance = this;
     Init();
 }
예제 #4
0
 void OnEnable()
 {
     script = (PortalManager)target;
 }
예제 #5
0
 //initializes the portal tree
 void Awake()
 {
     instance = this;
     Init();
 }