internal NpcView GetNpcViewById(int objId) { NpcView view = null; m_NpcViews.TryGetValue(objId, out view); return(view); }
private void ChangeCameraToPartner(ArenaStateInfo state) { NpcInfo not_dead_partner = FindNotdeadPartner(state.CreatedPartners); if (not_dead_partner != null) { NpcView view = EntityManager.Instance.GetNpcViewById(not_dead_partner.GetId()); if (view != null) { GfxSystem.SendMessage("GfxGameRoot", "CameraFollow", view.Actor); state.CurCameraTargetPartner = not_dead_partner.GetId(); } } }
internal void CreateNpcView(int objId) { if (!m_NpcViews.ContainsKey(objId)) { NpcInfo obj = WorldSystem.Instance.NpcManager.GetNpcInfo(objId); if (null != obj) { NpcView view = new NpcView(); view.Create(obj); m_NpcViews.Add(objId, view); } WorldSystem.Instance.SyncGfxNpcInfo(objId); } }
public static NpcInfo SummonNpc(int id, int owner_id, int owner_skillid, int npc_type_id, string modelPrefab, int skillid, int ailogicid, bool followsummonerdead, float x, float y, float z, string aiparamstr, int signforskill, bool isSimulate = false, bool is_start_skill = true) { CharacterInfo charObj = WorldSystem.Instance.GetCharacterById(owner_id); if (charObj == null) { return(null); } Data_Unit data = new Data_Unit(); data.m_Id = -1; data.m_LinkId = npc_type_id; data.m_CampId = charObj.GetCampId(); data.m_IsEnable = true; data.m_Pos = new Vector3(x, y, z); data.m_RotAngle = 0; data.m_AiLogic = ailogicid; if (!string.IsNullOrEmpty(aiparamstr)) { string[] strarry = aiparamstr.Split(new char[] { ',' }, 8); int i = 0; foreach (string str in strarry) { data.m_AiParam[i++] = str; } } NpcInfo npc; if (id <= 0) { npc = WorldSystem.Instance.NpcManager.AddNpc(data); } else { npc = WorldSystem.Instance.NpcManager.AddNpc(id, data); } if (WorldSystem.Instance.IsExpeditionScene() || WorldSystem.Instance.IsMultiPveScene()) { float fightscore = 0; CharacterProperty info = charObj.GetActualProperty(); if (null != info) { CharacterProperty base_info = charObj.GetBaseProperty(); float assit_critical_pow = (null != base_info ? info.CriticalPow - base_info.CriticalPow : info.CriticalPow); float assit_critical_backhit_pow = (null != base_info ? info.CriticalBackHitPow - base_info.CriticalBackHitPow : info.CriticalBackHitPow); float assit_critical_crack_pow = (null != base_info ? info.CriticalCrackPow - base_info.CriticalCrackPow : info.CriticalCrackPow); fightscore = AttributeScoreConfigProvider.Instance.CalcAttributeScore(info.HpMax, info.EnergyMax, info.AttackBase, info.ADefenceBase, info.MDefenceBase, info.Critical, assit_critical_pow, assit_critical_backhit_pow, assit_critical_crack_pow, info.FireDamage, info.IceDamage, info.PoisonDamage, info.FireERD, info.IceERD, info.PoisonERD) + charObj.GetSkillStateInfo().GetSkillAppendScore(); } WorldSystem.Instance.AdditionNpcAttr(npc, Mathf.FloorToInt(fightscore)); } if (!string.IsNullOrEmpty(modelPrefab)) { npc.SetModel(modelPrefab); } npc.FollowSummonerDead = followsummonerdead; SkillInfo skillinfo = new SkillInfo(skillid); npc.GetSkillStateInfo().AddSkill(skillinfo); npc.SkillController = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance); npc.GetMovementStateInfo().SetPosition(data.m_Pos); npc.SummonOwnerId = charObj.GetId(); npc.SignForSkill = signforskill; EntityManager.Instance.CreateNpcView(npc.GetId()); charObj.GetSkillStateInfo().AddSummonObject(npc); NpcView npcview = EntityManager.Instance.GetNpcViewById(npc.GetId()); CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(charObj.GetId()); npcview.ObjectInfo.SummonOwnerActorId = owner_view.Actor; npcview.ObjectInfo.SummonOwnerSkillId = owner_skillid; npcview.ObjectInfo.SignForSkill = signforskill; npcview.ObjectInfo.IsSimulate = isSimulate; if (ailogicid > 0) { npcview.ObjectInfo.IsSummonWithAI = true; } //LogSystem.Debug("---summon npc: issimulate=" + isSimulate); owner_view.ObjectInfo.Summons.Add(npcview.Actor); if (is_start_skill) { npc.SkillController.ForceStartSkill(skillid); } //LogSystem.Debug("---create summon npc over!"); return(npc); }