Exemplo n.º 1
0
    public override bool FindNearestTarget()
    {
        if (TargetObj)
        {
            return(true);
        }

        bool    bFinded         = false;
        float   CheckTargetDist = 100.0f;
        Vector3 CurPos          = gameObject.transform.position;

        GameObject[] FindObjs = GameObject.FindGameObjectsWithTag("PlayerCharacter");
        foreach (GameObject FindObj in FindObjs)
        {
            CPlayerCharacter FindChar = FindObj.GetComponent <CPlayerCharacter>();
            if (FindChar.curState != EState.Die)
            {
                float TargetDist = Vector3.Distance(FindObj.transform.position, CurPos);
                if (TargetDist < CheckTargetDist && TargetDist <= EyeSight)
                {
                    CheckTargetDist = TargetDist;
                    TargetObj       = FindObj;
                    bFinded         = true;
                }
            }
        }
        return(bFinded);
    }
Exemplo n.º 2
0
    // Use this for initialization
    protected virtual void Start()
    {
        animationData = new AnimationData(FindObj.FindChild(this.gameObject, "Animation").GetComponent <SkeletonAnimation>());
        mAttData      = new AttributeData(this);

        CreateSKillData();
    }
Exemplo n.º 3
0
    // Use this for initialization
    static void AddWindow()
    {
        //创建窗口
        Rect    wr     = new Rect(0, 0, 640, 480);
        FindObj window = (FindObj)EditorWindow.GetWindowWithRect(typeof(FindObj), wr, true, "FindObj");

        window.Show();
    }