public Units SpawnEyeItemInstance(EntityVo npcinfo, string tag, TeamType teamType, string respawnInterval, Transform newSpawnPoint, SVector3 eyeItemInfoInst, string eyeItemPreObjRes, UnitControlType controlType) { if (npcinfo == null || npcinfo.npc_id == null || npcinfo.npc_id == string.Empty || tag == null) { return(null); } string npc_id = npcinfo.npc_id; SysMonsterMainVo monsterMainData = BaseDataMgr.instance.GetMonsterMainData(npc_id); if (monsterMainData == null) { ClientLogger.Error("SpawnInstance: no npc found #" + npc_id); return(null); } Dictionary <DataType, object> dictionary = new Dictionary <DataType, object> { { DataType.NameId, npc_id }, { DataType.ModelId, monsterMainData.model_id }, { DataType.TeamType, teamType }, { DataType.AIType, npcinfo.ai_type }, { DataType.AttrFactor, SpawnUtility.GetAttrFactor(teamType, this._myScene) } }; if (npcinfo.uid != 0) { dictionary.Add(DataType.UniqueId, npcinfo.uid); } Dictionary <AttrType, float> unitAttrs = new Dictionary <AttrType, float>(); return(MapManager.Instance.SpawnEyeItemUnit(tag, dictionary, unitAttrs, newSpawnPoint, eyeItemInfoInst, eyeItemPreObjRes, controlType, false)); }
public Units SpawnInstance(EntityVo npcinfo, string tag, TeamType teamType, int spawnPos, string respawnInterval = "[]", Transform newSpawnPoint = null, UnitControlType controlType = UnitControlType.None, UnitType unitType = UnitType.None) { if (npcinfo == null || npcinfo.npc_id == null || npcinfo.npc_id == string.Empty || tag == null) { ClientLogger.Error("SpawnInstance line 1 null"); return(null); } Dictionary <AttrType, float> dictionary = new Dictionary <AttrType, float>(); if (tag == "Hero" || tag == "Player") { string npc_id = npcinfo.npc_id; int level = npcinfo.level; int quality = npcinfo.quality; int star = npcinfo.star; float hp = npcinfo.hp; float mp = npcinfo.mp; SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(npc_id); if (heroMainData == null || heroMainData.model_id == null) { ClientLogger.Error("SpawnInstance: no hero found #" + npc_id); return(null); } Dictionary <DataType, object> dictionary2 = new Dictionary <DataType, object> { { DataType.NameId, npc_id }, { DataType.ModelId, heroMainData.model_id }, { DataType.TeamType, teamType }, { DataType.AIType, 2 }, { DataType.AttrFactor, SpawnUtility.GetAttrFactor(teamType, this._myScene) }, { DataType.Level, level }, { DataType.Quality, quality }, { DataType.Star, star }, { DataType.Skin, npcinfo.skin } }; if (npcinfo.uid != 0) { dictionary2.Add(DataType.UniqueId, npcinfo.uid); } if (hp != 0f) { dictionary.Add(AttrType.Hp, hp); } if (mp != 0f) { dictionary.Add(AttrType.Mp, mp); } Transform transform = newSpawnPoint; if (!transform) { transform = MapManager.Instance.GetSpawnPos(teamType, spawnPos); } Units result = MapManager.Instance.SpawnUnit(tag, dictionary2, dictionary, transform.position, transform.rotation, controlType, true, null, unitType); if (!transform) { ClientLogger.Error(string.Format("SpawnInstance: GetSpawnPos failed for {0} {1} in {2}", teamType, spawnPos, LevelManager.CurLevelId)); } return(result); } else if (tag.Equals("Home")) { string npc_id2 = npcinfo.npc_id; Transform transform2 = newSpawnPoint; if (!transform2) { transform2 = MapManager.Instance.GetSpawnPos(teamType, npcinfo.pos); } SysMonsterMainVo monsterMainData = BaseDataMgr.instance.GetMonsterMainData(npc_id2); if (monsterMainData == null) { ClientLogger.Error("SpawnInstance: no home found #" + npc_id2); return(null); } Dictionary <DataType, object> dictionary3 = new Dictionary <DataType, object> { { DataType.NameId, npc_id2 }, { DataType.ModelId, monsterMainData.model_id }, { DataType.TeamType, teamType }, { DataType.AIType, npcinfo.ai_type }, { DataType.AttrFactor, SpawnUtility.GetAttrFactor(teamType, this._myScene) }, { DataType.Skin, npcinfo.skin } }; if (npcinfo.uid != 0) { dictionary3.Add(DataType.UniqueId, npcinfo.uid); } return(MapManager.Instance.SpawnUnit(tag, dictionary3, dictionary, transform2.position, transform2.rotation, controlType, false, null, unitType)); } else { string npc_id3 = npcinfo.npc_id; Transform transform3 = newSpawnPoint; if (!transform3) { transform3 = MapManager.Instance.GetSpawnPos(teamType, npcinfo.pos); } SysMonsterMainVo monsterMainData2 = BaseDataMgr.instance.GetMonsterMainData(npc_id3); if (monsterMainData2 == null) { ClientLogger.Error("SpawnInstance: no npc found #" + npc_id3); return(null); } Dictionary <DataType, object> dictionary4 = new Dictionary <DataType, object> { { DataType.NameId, npc_id3 }, { DataType.ModelId, monsterMainData2.model_id }, { DataType.TeamType, teamType }, { DataType.AIType, npcinfo.ai_type }, { DataType.AttrFactor, SpawnUtility.GetAttrFactor(teamType, this._myScene) }, { DataType.Skin, npcinfo.skin } }; if (npcinfo.uid != 0) { dictionary4.Add(DataType.UniqueId, npcinfo.uid); } return(MapManager.Instance.SpawnUnit(tag, dictionary4, dictionary, transform3.position, transform3.rotation, controlType, false, null, unitType)); } }
public float GetAttrFactor(TeamType teamType) { return(SpawnUtility.GetAttrFactor(teamType, this._myScene)); }