void OnDrawGizmosSelected()
    {
        if (!enabled)
        {
            return;
        }
        CheckPathMarkScale();
        UpdateMeshFilter();

        Transform parTran    = transform.parent;
        NpcMark   markScript = parTran.GetComponent <NpcMark>();

        if (markScript != null)
        {
            markScript.DrawPath();
            return;
        }
        else
        {
            if (parTran.childCount > 1)
            {
                List <Transform> nodesTran = new List <Transform>(parTran.GetComponentsInChildren <Transform>())
                {
                };
                nodesTran.Remove(parTran);
                iTween.DrawPath(nodesTran.ToArray(), Color.blue);
                return;
            }
        }
    }
    void OnDrawGizmosSelected()
    {
        if (!enabled)
        {
            return;
        }

        if (AiPathMark != null)
        {
            Transform  AiPathTran = AiPathMark.transform.parent;
            AiPathCtrl pathScript = AiPathTran.GetComponent <AiPathCtrl>();
            pathScript.DrawPath();
        }

        if (NpcPathCtrl != null)
        {
            Transform NpcMarkTran   = NpcPathCtrl.transform.GetChild(0);
            NpcMark   NpcMarkScript = NpcMarkTran.GetComponent <NpcMark>();
            NpcMarkScript.DrawPath();
        }

        if (NpcPathCtrl != null || AiPathMark != null)
        {
            Transform [] tranArray = new Transform[2];
            if (NpcPathCtrl == null && AiPathMark != null)
            {
                tranArray[0] = transform;
                tranArray[1] = AiPathMark.transform;
                iTween.DrawPath(tranArray, Color.yellow);
            }
            else if (NpcPathCtrl != null)
            {
                tranArray[0] = transform;
                tranArray[1] = NpcPathCtrl.transform.GetChild(0);
                iTween.DrawPath(tranArray, Color.yellow);

                if (AiPathMark != null)
                {
                    tranArray[0] = NpcPathCtrl.transform.GetChild(NpcPathCtrl.transform.childCount - 1);
                    tranArray[1] = AiPathMark.transform;
                    iTween.DrawPath(tranArray, Color.yellow);
                }
            }
        }

        CheckTransformScale();
        UpdateMeshFilter();
    }
Пример #3
0
    void OnDrawGizmosSelected()
    {
        if (!XkGameCtrl.IsDrawGizmosObj)
        {
            return;
        }

        if (!enabled)
        {
            return;
        }

        if (NpcMarkScript == null)
        {
            return;
        }
        NpcMarkScript.DrawPath();
    }