コード例 #1
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (animatorAI == null)
        {
            animatorAI = animator.gameObject.GetComponent <AnimatorAI>();
        }

        timeEnteredState = Time.time;

        animatorAI.topText.SetText("CurrentBehavior:" + this.GetType().ToString());

        animator.Play("Attack01", animator.GetLayerIndex("Base Layer"));
    }
コード例 #2
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (animatorAI == null)
        {
            animatorAI = animator.gameObject.GetComponent <AnimatorAI>();
        }

        animatorAI.topText.SetText("CurrentBehavior:" + this.GetType().ToString());

        if (animatorAI.currentTarget == null)
        {
            animator.Play("Idle", animator.GetLayerIndex("Behaviors"));
            return;
        }

        animator.Play("Walk", animator.GetLayerIndex("Base Layer"));
    }
コード例 #3
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (animatorAI == null)
        {
            animatorAI = animator.gameObject.GetComponent <AnimatorAI>();
        }

        animatorAI.topText.SetText("CurrentState:" + this.GetType().ToString());

        if (animatorAI.currentTarget != null)
        {
            animatorAI.moveDirection = (animatorAI.currentTarget.transform.position - animatorAI.transform.position).normalized;

            animator.Play("Walk", animator.GetLayerIndex("Base Layer"));
        }

        animator.Play("Walk", animator.GetLayerIndex("Base Layer"));
    }