示例#1
0
    private void SetConfigData()
    {
        this.data = Singleton <SkillUnitDataMgr> .Instance.GetVo(this.self.npc_id);

        base.SetData(DataType.NameId, this.data.config.unit_id);
        base.SetData(DataType.DisplayName, this.data.config.unit_name);
        base.SetData(DataType.ModelId, this.data.config.model_id);
        base.SetData(DataType.CharacterType, this.data.config.character_type);
        base.SetData(DataType.AttackType, this.data.config.atk_type);
        base.SetData(DataType.Skills, StringUtils.GetStringValue(this.data.config.skill_id, ','));
        base.SetData(DataType.Attacks, StringUtils.GetStringValue(this.data.config.attack_id, ','));
        base.SetAttr(AttrType.AttackSpeed, this.GetData(this.data.config.atk_speed));
        base.SetAttr(AttrType.MoveSpeed, this.GetData(this.data.config.move_speed));
        base.SetAttr(AttrType.AttackRange, this.GetData(this.data.config.atk_range));
        base.SetAttr(AttrType.WarningRange, this.GetData(this.data.config.warning_range));
        base.SetAttr(AttrType.Attack, this.GetData(this.data.config.attack));
        base.SetAttr(AttrType.Armor, this.GetData(this.data.config.armor));
        base.SetAttr(AttrType.MagicResist, this.GetData(this.data.config.resistance));
        base.SetAttr(AttrType.HpMax, this.GetData(this.data.config.hp));
        base.SetAttr(AttrType.MpMax, this.GetData(this.data.config.mp));
        base.SetAttr(AttrType.HpRestore, this.GetData(this.data.config.hp_restore));
        base.SetAttr(AttrType.MpRestore, this.GetData(this.data.config.mp_restore));
        base.SetAttr(AttrType.PhysicPower, this.GetData(this.data.config.pysic_power));
        base.SetAttr(AttrType.MagicPower, this.GetData(this.data.config.magic_power));
        base.SetAttr(AttrType.HitProp, this.GetData(this.data.config.hit_prop));
        base.SetAttr(AttrType.DodgeProp, this.GetData(this.data.config.dodge_prop));
        base.SetAttr(AttrType.PhysicCritProp, this.GetData(this.data.config.physic_crit_prop));
        base.SetAttr(AttrType.MagicCritProp, this.GetData(this.data.config.magic_crit_prop));
        base.SetAttr(AttrType.PhysicCritMag, this.GetData(this.data.config.crit_mag));
        base.SetAttr(AttrType.MagicCritMag, this.GetData(this.data.config.magic_crit_mag));
        base.SetAttr(AttrType.ArmorCut, this.GetData(this.data.config.armor_cut));
        base.SetAttr(AttrType.MagicResistanceCut, this.GetData(this.data.config.resistance_cut));
    }
        public static Units CreateMapItem(MapItemInfo info, UnitControlType unitControlType = UnitControlType.None)
        {
            if (info == null)
            {
                return(null);
            }
            SkillUnitData vo = Singleton <SkillUnitDataMgr> .Instance.GetVo(info.uniTypeId);

            if (vo == null)
            {
                return(null);
            }
            Dictionary <DataType, object> dictionary = new Dictionary <DataType, object>();

            dictionary.Add(DataType.NameId, info.uniTypeId);
            dictionary.Add(DataType.TeamType, (TeamType)info.group);
            if (info.unitId != 0)
            {
                dictionary.Add(DataType.UniqueId, info.unitId);
            }
            Units units;

            if (vo.IsBloodBall)
            {
                units = MapManager.Instance.SpawnBuffItem(dictionary, null, MoveController.SVectgor3ToVector3(info.burnPos), Quaternion.identity, unitControlType);
            }
            else
            {
                Units unit = MapManager.Instance.GetUnit(info.callUnitId);
                units = MapManager.Instance.SpawnSkillUnit(dictionary, null, MoveController.SVectgor3ToVector3(info.burnPos), Quaternion.identity, unitControlType, unit, info.callSkillId);
                HighEffectData vo2 = Singleton <HighEffectDataManager> .Instance.GetVo(info.hieffId);

                if (vo2 != null)
                {
                    List <Units> list = new List <Units>();
                    if (info.targetUnitIds != null)
                    {
                        for (int i = 0; i < info.targetUnitIds.Count; i++)
                        {
                            Units unit2 = MapManager.Instance.GetUnit(info.targetUnitIds[i]);
                            list.Add(unit2);
                        }
                    }
                    BornUnitAction.SetPosition(units, list, unit, vo2, MoveController.SVectgor3ToVector3(info.burnPos));
                }
            }
            if (units)
            {
                units.UpdateVisible();
            }
            return(units);
        }
        public static Units CreateMapItem(UnitRuntimeInfo info, UnitControlType unitControlType = UnitControlType.None)
        {
            if (info == null)
            {
                return(null);
            }
            if (info.baseUnitInfo == null)
            {
                return(null);
            }
            if (info.baseUnitInfo.skillunitInfo == null)
            {
                return(null);
            }
            SkillUnitData vo = Singleton <SkillUnitDataMgr> .Instance.GetVo(info.baseUnitInfo.typeId);

            if (vo == null)
            {
                return(null);
            }
            Dictionary <DataType, object> dictionary = new Dictionary <DataType, object>();

            dictionary.Add(DataType.NameId, info.baseUnitInfo.typeId);
            dictionary.Add(DataType.TeamType, (TeamType)info.baseUnitInfo.group);
            if (info.baseUnitInfo.unitId != 0)
            {
                dictionary.Add(DataType.UniqueId, info.baseUnitInfo.unitId);
            }
            Units result;

            if (vo.IsBloodBall)
            {
                result = MapManager.Instance.SpawnBuffItem(dictionary, null, MoveController.SVectgor3ToVector3(info.baseUnitInfo.skillunitInfo.burnPos), Quaternion.identity, unitControlType);
            }
            else
            {
                result = MapManager.Instance.SpawnSkillUnit(dictionary, null, MoveController.SVectgor3ToVector3(info.baseUnitInfo.skillunitInfo.burnPos), Quaternion.identity, unitControlType, null, string.Empty);
            }
            return(result);
        }