Esempio n. 1
0
    public override void init()
    {
        base.init();

        _fightLogic      = _unit.fight;
        _commandLogic    = _unit.aiCommand;
        _fightUnitConfig = _fightLogic.getFightUnitConfig();

        if (_unit.isSelfControl())
        {
            // setAIMode(_fightUnitConfig.defaultAIMode);
            setAIMode(UnitAIModeType.Base);
            setWanderOnIdle(_fightUnitConfig.isWanderOnIdle);
        }
        else
        {
            setAIMode(UnitAIModeType.None);
        }

        setWanderOnIdle(_fightUnitConfig.isWanderOnIdle);
        _maxPursueDistanceSq = _fightUnitConfig.maxPursueRadius * _fightUnitConfig.maxPursueRadius;

        _unitSkills = _unit.getUnitData().fight.skills;

        FightUnitLevelConfig levelConfig = FightUnitLevelConfig.get(_fightUnitConfig.id, _fightLogic.getLevel());

        if (levelConfig.skills.Length > 0)
        {
            _defaultSkill = _unitSkills.get(levelConfig.skills[0].key);
        }
        else
        {
            _defaultSkill = null;
        }
    }
Esempio n. 2
0
    /** 通过战斗单位等级初始化 */
    public void initByFightUnitLevelConfig(int id, int level)
    {
        FightUnitLevelConfig levelConfig = FightUnitLevelConfig.get(id, level);

        //属性
        attribute.addAttributes(levelConfig.attributes);
        //技能
        addSkills(levelConfig.skills);
        //buff
        buff.addBuffs(levelConfig.buffs);
        //当前属性
        attribute.makeCurrentToDefault();
    }