Esempio n. 1
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     base.OnStateEnter(animator, stateInfo, layerIndex);
     mainLayer  = 0; // animator.GetLayerIndex(csMainAniLayer);
     aniControl = animator.gameObject.transform.GetComponent <modelAnimatorControl>();
     aiControl  = animator.gameObject.transform.GetComponent <baseAI>();
 }
Esempio n. 2
0
    //切换动作状态
    public void PlayAIState(roleState state)
    {
        if (aniCon == null)
        {
            aniCon = this.gameObject.GetComponent <IbaseAnimator>();
        }

        aniCon.PlayState(state);
    }
Esempio n. 3
0
    public void AIInitData(GameObject paraObj)
    {
        if (aniCon == null)
        {
            aniCon = this.gameObject.GetComponent <IbaseAnimator>();
        }

        aniCon.initData(paraObj);
    }
Esempio n. 4
0
    public bool isAIState(roleState state)
    {
        bool res = false;

        if (aniCon == null)
        {
            aniCon = this.gameObject.GetComponent <IbaseAnimator>();
        }

        res = aniCon.isInPlayEntry(state);

        return(res);
    }
Esempio n. 5
0
    //根据输入按键来获得动作状态
    public roleState getHopeState(float h, float tmpv, int fireSoft, roleState nowState)
    {
        if (aniCon == null)
        {
            aniCon = this.gameObject.GetComponent <IbaseAnimator>();
        }

        // roleState nowState = aniCon.getRoleNowState();
        roleState res = roleState.init;

        if (nowState == roleState.die)
        {
            res = nowState;
            return(res);
        }

        if (enemyObj == null)                  //无攻击目标
        {
            if ((h == 0.0f) && (tmpv == 0.0f)) //没有输入
            {
                res = roleState.stand;
            }
            else
            {
                res = roleState.run;
            }
        }
        else
        {
            if (fireSoft == 1)
            {
                res = roleState.attack;
            }
            else if (fireSoft == 2)
            {
                res = roleState.attack2;
            }
            else if (fireSoft == 3)
            {
                res = roleState.def;
            }
            else
            {
                res = nowState;
            }
        }

        return(res);
    }
Esempio n. 6
0
    public override void stateStandEnd()
    {
        IbaseAnimator tmpAni = this.transform.GetComponent <IbaseAnimator>();

        tmpAni.PlayState(roleState.stand);
    }