Ejemplo n.º 1
0
    //准备释放魔法
    public void PrepareMagic(Hero _hero, Magic _magic)
    {
        //判定魔法学派,根据英雄的相应学派等级释放不同效果
        int magicLevel = _magic.GetMagicLevel(_hero);

        MagicType type = _magic.type;

        if (type == MagicType.Battle)
        {
        }

        currentMagic = _magic;

        //隐藏节点
        NodeSelector.HideActionNodes();

        //目标类型:无目标直接释放
        int targetType = Mathf.Min(_magic.targetType.Length - 1, magicLevel);

        //int effect = Mathf.Min(_magic.effects.Length - 1, magicLevel);
        if (_magic.targetType[targetType] == MagicTargetType.Null)
        {
            CastMagic();
        }
        else
        {
            //是需要选择目标的技能
            MagicTargetFliter fliter = _magic.targetFliter[Mathf.Min(_magic.targetFliter.Length - 1, magicLevel)];

            NodeSelector.GetSpellableNodes(fliter);
        }
    }
Ejemplo n.º 2
0
    IEnumerator ActionStartCor(Unit _unit)
    {
        UnitHaloMgr.instance.HaloFlashStart(_unit, "action");

        //测试:永远是玩家控制
        //PlayerActionStart(_unit);


        if (!GameManager.instance.players[BattleManager.players[_unit.side]].isAI)
        {
            PlayerActionStart(_unit);
        }
        else
        {
            AIActionMgr.instance.AIActionStart(_unit);
        }

        //在下令前暂停
        while (order == null)
        {
            yield return(null);
        }

        //发出指令后,开始执行命令
        UnitHaloMgr.instance.HaloFlashStop(_unit);
        //重置所有可行动节点
        if (!GameManager.instance.players[BattleManager.players[_unit.side]].isAI)
        {
            NodeSelector.HideActionNodes();
        }
        //执行指令
        InvokeOrder();

        GameManager.gameState = GameState.canNotControl;
        //在指令完成前暂停
        while (order != null)
        {
            yield return(null);
        }

        //命令执行完毕

        yield return(new WaitForSeconds(.5f));

        ActionEnd();
    }