public override void OnClick(GameObject characterGameObject)
        {
            if (!this.isPlayAnimation)
            {
                CharacterParams component = characterGameObject.GetComponent <CharacterParams>();
                if (null != component && null != component.transform.parent)
                {
                    this.isPlayAnimation = true;
                    switch (UnityEngine.Random.Range(0, 3))
                    {
                    case 0:
                        component.PlayAnimationSmooth(CharacterAnimationType.win, SkillType.Attack, 0, null, null);
                        this.animationTimeLength = component.AnimationClipLength;
                        break;

                    case 1:
                        component.PlayAnimationSmooth(CharacterAnimationType.eat, SkillType.Attack, 0, null, null);
                        this.animationTimeLength = component.AnimationClipLength;
                        break;

                    case 2:
                        component.PlayAnimationSmooth(CharacterAnimationType.attacks, SkillType.Attack, 0, null, null);
                        this.animationTimeLength = component.AnimationClipLength;
                        break;
                    }
                }
            }
        }
Exemple #2
0
    private IEnumerator WaitEndAction()
    {
        FarmDigimonAI.ActionParam param = this.farmDigimonAI.GetActionParam();
        switch (param.actionID)
        {
        case FarmDigimonAI.ActionID.MEAT_FARM:
        case FarmDigimonAI.ActionID.STROLL:
        case FarmDigimonAI.ActionID.STROLL_FAST:
        case FarmDigimonAI.ActionID.CONSTRUCTION:
            if (param.pathGridIndexs != null)
            {
                CharacterParams characterParams = this.digimon.GetComponent <CharacterParams>();
                characterParams.PlayAnimation(CharacterAnimationType.move, SkillType.Attack, 0, null, null);
                this.actionSubEnumerator = this.farmDigimonAction.Walk();
                yield return(base.StartCoroutine(this.actionSubEnumerator));

                this.actionSubEnumerator = null;
            }
            break;

        case FarmDigimonAI.ActionID.TOUCH_ACTION:
        {
            CharacterParams characterParams2 = this.digimon.GetComponent <CharacterParams>();
            characterParams2.PlayAnimation(CharacterAnimationType.move, SkillType.Attack, 0, null, null);
            this.actionSubEnumerator = this.farmDigimonAction.TouchAction();
            yield return(base.StartCoroutine(this.actionSubEnumerator));

            this.actionSubEnumerator = null;
            break;
        }

        default:
        {
            CharacterParams component = this.digimon.GetComponent <CharacterParams>();
            component.PlayAnimationSmooth(CharacterAnimationType.revival, SkillType.Attack, 0, null, null);
            break;
        }
        }
        CharacterParams component2 = this.digimon.GetComponent <CharacterParams>();

        component2.PlayAnimationSmooth(CharacterAnimationType.revival, SkillType.Attack, 0, null, null);
        yield return(new WaitForSeconds(5f));

        this.farmDigimonAI.ClearActionParam();
        this.actionState = FarmDigimon.ActionState.THINKING;
        yield return(null);

        yield break;
    }