Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (mNavMeshActors.Count == 0)
        {
            return;
        }
        if (Input.GetMouseButton(0))
        {
#if UNITY_EDITOR
            Path = mNavMesh.GetPath(mNavMeshActors[0].transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), ref HexInPath, ref TestedHex);
#else
            Path = mNavMesh.GetPath(mNavMeshActors[0].transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition));
#endif
            mNavMeshActors[0].SetPath(Path);
        }

#if UNITY_EDITOR
        if (TestedHex != null)
        {
            foreach (Hex hex in TestedHex)
            {
                DebugDrawHelper.DrawHex(mNavMesh.NavMap.MapLayout, hex, Color.blue);
            }
        }

        if (HexInPath != null)
        {
            foreach (Hex hex in HexInPath)
            {
                DebugDrawHelper.DrawHex(mNavMesh.NavMap.MapLayout, hex, Color.red);
            }
        }
#endif
    }