コード例 #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();
 }