Ejemplo n.º 1
0
    public override bool OnUpdate(Transform character)
    {
        switch (skillState)
        {
        case SkillState.init:
            if (Init(character))
            {
                skillState = SkillState.waitForInput;
            }
            break;

        case SkillState.waitForInput:
            if (final)
            {
                //角色取出忽略层
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 0);

                if (Check())
                {
                    foreach (var f in BattleFieldManager.GetInstance().floors)
                    {
                        if (f.Value.activeInHierarchy)
                        {
                            f.Value.GetComponent <Floor>().FloorClicked -= Confirm;
                            f.Value.GetComponent <Floor>().FloorExited  -= DeleteHoverRange;
                            f.Value.GetComponent <Floor>().FloorHovered -= Focus;
                        }
                    }
                    var player = RoundManager.GetInstance().Players.Find(p => p.playerNumber == SkillManager.GetInstance().skillQueue.Peek().Key.character.GetComponent <Unit>().playerNumber);
                    if (player is HumanPlayer || (player is AIPlayer && ((AIPlayer)player).AI == false))
                    {
                        ShowConfirm();
                    }
                }
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 2);
                final = false;
            }
            break;

        case SkillState.confirm:

            if (originSkill != null)
            {
                //有连续技。连续技第二个技能的InitSkill在AttackSkill的ApplyEffects中进行处理。
                originSkill.InitSkill();
            }
            else
            {
                //无连续技
                InitSkill();
            }

            skillState = SkillState.applyEffect;

            break;

        case SkillState.applyEffect:
            if (ApplyEffects())
            {
                animator.SetInteger("Skill", 0);
                return(true);
            }
            break;

        case SkillState.reset:
            return(true);
        }
        return(false);
    }
Ejemplo n.º 2
0
    public override bool OnUpdate(Transform character)
    {
        switch (skillState)
        {
        case SkillState.init:
            if (Init(character))
            {
                skillState = SkillState.waitForInput;
            }
            break;

        case SkillState.waitForInput:
            if (final)
            {
                //角色取出忽略层
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 0);

                if (Check())
                {
                    foreach (var f in BattleFieldManager.GetInstance().floors)
                    {
                        if (f.Value.activeInHierarchy)
                        {
                            f.Value.GetComponent <Floor>().FloorClicked -= Confirm;
                            f.Value.GetComponent <Floor>().FloorExited  -= DeleteHoverRange;
                            f.Value.GetComponent <Floor>().FloorHovered -= Focus;
                        }
                    }
                    ShowConfirm();
                }
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 2);
                final = false;
            }
            break;

        case SkillState.confirm:

            if (originSkill != null)
            {
                originSkill.InitSkill();
            }
            else
            {
                InitSkill();
            }

            skillState = SkillState.applyEffect;

            break;

        case SkillState.applyEffect:
            if (ApplyEffects())
            {
                animator.SetInteger("Skill", 0);
                return(true);
            }

            break;

        case SkillState.reset:
            return(true);
        }
        return(false);
    }