Exemple #1
0
        void Update()
        {
            if (!IsAwake)
            {
                if (Vector3.Distance(gameObject.transform.position, AiBase.target.transform.position) < 10)
                {
                    if (Vector3.Angle(gameObject.transform.TransformDirection(Vector3.forward), AiBase.target.transform.position) < 15)
                    {
                        RaycastHit hits;
                        if (Physics.Raycast(gameObject.transform.position, AiBase.target.transform.position - gameObject.transform.position, out hits, 10))
                        {
                            IsAwake = true;
                        }
                    }
                }
                return;
            }

            foreach (var actionStatuse in actionStatusDictionary.AllActionStatusDictionary)
            {
                if (animator.GetCurrentAnimatorStateInfo(0).IsTag(actionStatuse.Key))
                {
                    NowActionStatus = actionStatuse.Value;
                }
            }
            if (animator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 >= 0.99)
            {
                NowCommand = AiBase.DistanceBasicAI(3, 7);
                animator.SetTrigger("AI_" + NowCommand);
                actionBasic.SetupBeforeAction();
                actionBasic.BeforeCustomAction(NowActionStatus);
                RefreshAnimaterParameter();
                if (NowActionStatus.ignorelist != null)
                {
                    foreach (var cando in NowActionStatus.ignorelist)
                    {
                        animator.SetBool("avater_can_" + cando, false);
                    }
                }
            }
            OldActionStatus = NowActionStatus;
            IsEndNormal     = actionBasic.CustomAction(NowActionStatus);
            animator.SetBool("avater_IsEndNormal", IsEndNormal);
        }