Beispiel #1
0
 //Postdraw from the camera
 private void OnBeginDebug()
 {
     if (MobileAI.OnDebug != null)
     {
         MobileAI.OnDebug();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Get the shortest path from the starting position to the mouse position.
 /// Both start and end position need to be on the NavMesh.
 /// DEPRECATED
 /// </summary>
 public static NavNode PathToMousePosition(Vector3 startPosition)
 {
     return(MobileAI.Pathfind(startPosition, Instance.GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition)));
 }
Beispiel #3
0
        //Show the disclaimer for the data collection
        //private Disclaimer m_disclaimer;
        //public bool Disclaimer
        //{
        //	get { return m_disclaimer.IsVisible; }
        //}

        //Initialize the Touch framework engine.
        //The influence grid mey be camculated at execution or imported as file
        public void Awake()
        {
            s_instance = this;

            if (m_gridSize.x < 0)
            {
                throw new UnityException("The number of rows for the grid mst be greater than zero");
            }

            if (m_gridSize.y < 0)
            {
                throw new UnityException("The number of columns for the grid mst be greater than zero");
            }

            m_navMesh = (NavArea)(transform.GetComponent(typeof(NavArea)));

            //Set the volume of the Map
            if (m_volumeSize.x <= 0 || m_volumeSize.y <= 0 || m_volumeSize.z <= 0)
            {
                throw new UnityException("The volume size must be a positive value");
            }

            m_navMesh.SetVolume(m_volumeSize.x, m_volumeSize.y, m_volumeSize.z);

            //Create the grid
            m_navMesh.CreateGrid((int)m_gridSize.x, (int)m_gridSize.y);

            //Initialize the NavMesh with a file
            m_navMesh.Initialize(string.Empty, m_nonBlockingObjects);

            //Assign the camera
            if (m_targetCamera == null)
            {
                m_targetCamera = Camera.main;
            }

            //Debug Camera
            m_targetCamera.gameObject.AddComponent <Navigation.CameraPathtrace>();
            m_camera = m_targetCamera.gameObject.GetComponent("CameraPathtrace") as CameraPathtrace;

            //Hooking the OnBeginDebug event
            m_camera.OnBeginDebug -= OnBeginDebug;
            m_camera.OnBeginDebug += OnBeginDebug;

            m_gestureManager            = new GestureManager();
            m_gestureManager.DebugTrail = m_drawTrail;

            //Create the disclaimer window
            //m_disclaimer = new Disclaimer();
            //m_disclaimer.IsVisible = true;
            //StartCoroutine(m_disclaimer.DownloadContents());

            //Creates the log system
            m_logSystem = gameObject.AddComponent <LogSystem>();
            m_logSystem.transform.parent = null;

            if (m_trailDebug != null)
            {
                m_gestureManager.SetTrailPrefab(m_trailDebug);
            }

            m_algorithm = new AStar();
        }