/* Mostly imported wholesale from vanilla Bullet class, * except we create a temporary Bullet object for Notify_BulletImpactNearby. */ private void NotifyImpact(Thing hitThing, Map map, IntVec3 position) { var vanillaBullet = GenerateVanillaBullet(); BulletImpactData impactData = new BulletImpactData { bullet = vanillaBullet, hitThing = hitThing, impactPosition = position }; hitThing?.Notify_BulletImpactNearby(impactData); for (int i = 0; i < 9; i++) { IntVec3 c = position + GenRadial.RadialPattern[i]; if (c.InBounds(map)) { List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { if (thingList[j] != hitThing) { thingList[j].Notify_BulletImpactNearby(impactData); } } } } vanillaBullet.Destroy(); //remove previously created object after notifications are sent }
public void NotifyImpact(Thing hitThing, Map map, IntVec3 position) { BulletImpactData impactData = new BulletImpactData { bullet = this, hitThing = hitThing, impactPosition = position }; if (hitThing != null) { hitThing.Notify_BulletImpactNearby(impactData); } int num = 9; for (int i = 0; i < num; i++) { IntVec3 c = position + GenRadial.RadialPattern[i]; if (c.InBounds(map)) { List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { if (thingList[j] != hitThing) { thingList[j].Notify_BulletImpactNearby(impactData); } } } } }
public BulletImpactData GetBulletImpactData(int skillId, BulletData bData) { SkillConfigData skillData = SkillDataManager.Instance.GetSkillConfigData(skillId); if (skillData == null) { skillData = new SkillConfigData(); //如果没有技能数据,填充默认值,例如死亡子弹 } int calID = bData.m_calculateId; int strenthenSkillId = skillData.FatherSkill == 0? skillId : skillData.FatherSkill; SSkillInfo?skillInfo = SkillModel.Instance.GetCurSkill(strenthenSkillId); if (bData.m_bulletStrengthen == 1 && skillInfo != null && skillInfo.Value.byStrengthenLv > 1) { calID = bData.m_calculateId + skillInfo.Value.byStrengthenLv; } if (bData.m_calculateId == 0) { calID = 0; } BulletImpactData bulletImpactData = SkillDataManager.Instance.GetBulletImpactData(calID); if (null == bulletImpactData) { TraceUtil.Log("No impact Data"); } return(bulletImpactData); }
public static bool NotifyImpact(Bullet __instance, Thing hitThing, Map map, IntVec3 position) { BulletImpactData bulletImpactData = default(BulletImpactData); bulletImpactData.bullet = __instance; bulletImpactData.hitThing = hitThing; bulletImpactData.impactPosition = position; BulletImpactData impactData = bulletImpactData; hitThing?.Notify_BulletImpactNearby(impactData); int num = 9; for (int i = 0; i < num; i++) { IntVec3 c = position + GenRadial.RadialPattern[i]; if (!c.InBounds(map)) { continue; } List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { if (thingList[j] != hitThing) { thingList[j].Notify_BulletImpactNearby(impactData); } } } return(false); }
public BulletImpactData GetBulletImpactData(int bulletImpactId) { BulletImpactData data = null; m_bulletImpactDataDictionary.TryGetValue(bulletImpactId, out data); if (data == null) { if (bulletImpactId != 0) { TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "子弹结算:" + bulletImpactId.ToString() + " 错误"); TraceUtil.Log(SystemModel.NotFoundInTheDictionary, TraceLevel.Error, "子弹结算:" + bulletImpactId.ToString() + " 错误"); } } return(data); }
public void Awake() { for (int i = 0; i < bulletImpactDataArray.Length; i++) { BulletImpactData bulletImpactData = bulletImpactDataArray[i]; string bulletImpactPoolName = bulletImpactData.bulletImpactPoolName; GameObjectPoolItem bulletImpactPoolItem = bulletImpactData.bulletImpactPoolItem; int bulletImpactPreNum = bulletImpactData.bulletImpactPreNum; if (GameObjectPoolManager.HasGameObjectPool(bulletImpactPoolName) == false) { GameObjectPoolManager.CreateGameObjectPoolForGameObject(bulletImpactPoolName, bulletImpactPoolItem.gameObject, bulletImpactPreNum); } GameObjectPool bulletImpactPool = GameObjectPoolManager.GetGameObjectPool(bulletImpactPoolName); m_ImpactPoolDictionary.Add(bulletImpactPoolItem.gameObject.layer, bulletImpactPool); } }
public void InitBulletFromServer(int bulletID, Int64 entityID, BulletData data, long targetId) { BulletData = data; m_impactData = SkillDataManager.Instance.GetBulletImpactData(data.m_calculateId); BulletID = -1; FormEntityID = entityID; m_targetId = targetId; //BulletIndex = BulletManager.Instance.CalendarIndex(entityID); m_motionVector = Vector3.zero; m_accelerationVector = Vector3.zero; m_thisTransfrom = this.transform; //m_impactData = GetBulletImpactData(skillId, data); BattleManager.Instance.BulletBornShakeCamera(BulletData, FormEntityID); // if(!string.IsNullOrEmpty( BulletData.m_bornSfxId) && BulletData.m_bornSfxId != "0") // { // SoundManager.Instance.PlaySoundEffect(BulletData.m_bornSfxId); // } PlayBulletBornSound(BulletData); TypeID type; EntityModel ownerData = EntityController.Instance.GetEntityModel(FormEntityID, out type); m_cachedBeatBackDir = ownerData.GO.transform.TransformDirection(Vector3.forward); if (type == TypeID.TYPEID_PLAYER) { var playerDataStruct = (IPlayerDataStruct)ownerData.EntityDataStruct; m_srcHit = playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_NICETY; m_srcLevel = playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL; m_ownerCampType = (CampType)playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_FIGHT_HOSTILITY; } else if (type == TypeID.TYPEID_MONSTER) { SMsgPropCreateEntity_SC_Monster monsterData = (SMsgPropCreateEntity_SC_Monster)ownerData.EntityDataStruct; m_srcHit = monsterData.MonsterInvisibleValue.UNIT_FIELD_NICETY; m_srcLevel = monsterData.MonsterUnitValues.UNIT_FIELD_LEVEL; m_ownerCampType = (CampType)monsterData.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY; } }
private void NotifyImpact(Thing hitThing, Map map, IntVec3 position) { BulletImpactData bulletImpactData = default(BulletImpactData); bulletImpactData.bullet = this; bulletImpactData.hitThing = hitThing; bulletImpactData.impactPosition = position; BulletImpactData impactData = bulletImpactData; try { hitThing?.Notify_BulletImpactNearby(impactData); } catch { }; int num = 9; for (int i = 0; i < num; i++) { IntVec3 c = position + GenRadial.RadialPattern[i]; if (!c.InBounds(map)) { continue; } List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { if (thingList[j] != hitThing) { try { thingList[j].Notify_BulletImpactNearby(impactData); } catch { }; } } } }
private static void NotifyImpact(ProjectileCE __instance, Thing launcher, Thing hitThing, Map map, IntVec3 position) { Bullet bullet = GenerateVanillaBullet(__instance, launcher); BulletImpactData impactData = new BulletImpactData { bullet = bullet, hitThing = hitThing, impactPosition = position }; bool flag = hitThing != null; if (flag) { hitThing.Notify_BulletImpactNearby(impactData); } int num = 9; for (int i = 0; i < num; i++) { IntVec3 c = position + GenRadial.RadialPattern[i]; bool flag2 = c.InBounds(map); if (flag2) { List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { bool flag3 = thingList[j] != hitThing; if (flag3) { thingList[j].Notify_BulletImpactNearby(impactData); } } } } bullet.Destroy(DestroyMode.Vanish); }
public virtual void Notify_BulletImpactNearby(BulletImpactData impactData) { }
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath) { if (CheckResModified(importedAssets) || CheckResModified(deletedAssets) || CheckResModified(movedAssets)) { string path = System.IO.Path.Combine(EW_RESOURCE_SKILL_CONFIG_FOLDER, "BulletImpact.xml"); TextReader tr = new StreamReader(path); string text = tr.ReadToEnd(); if (text == null) { Debug.LogError("Bullet data file not exist"); return; } else { XmlSpreadSheetReader.ReadSheet(text); XmlSpreadSheet sheet = XmlSpreadSheetReader.Output; string[] keys = XmlSpreadSheetReader.Keys; object[] levelIds = sheet[keys[0]]; List <BulletImpactData> tempList = new List <BulletImpactData>(); for (int i = 2; i < levelIds.Length; i++) { BulletImpactData data = new BulletImpactData(); data.m_id = Convert.ToInt32(sheet["id"][i]); data.m_damage_type = Convert.ToInt32(sheet["damage_type"][i]); data.m_beatBackLevel = Convert.ToInt32(sheet["hit_lv"][i]); data.m_beatBackDir = Convert.ToInt32(sheet["hit_dir"][i]); data.m_beatBackDuration = Convert.ToSingle(sheet["hit_time"][i]); data.m_beatBackSpeed = Convert.ToSingle(sheet["hit_speed"][i]); data.m_beatBackAcceleration = Convert.ToSingle(sheet["hit_accspeed"][i]); data.m_beatFlyLevel = Convert.ToInt32(sheet["fly_level"][i]); data.m_beatFlySpeed = Convert.ToSingle(sheet["fly_speed"][i]); data.m_beatFlyAcceleration = Convert.ToSingle(sheet["fly_accspeed"][i]); data.m_beatFlyVerticalSpeed = Convert.ToSingle(sheet["fly_verspeed"][i]); data.m_teleportLevel = Convert.ToSingle(sheet["teleport_level"][i]); var desInfo = Convert.ToString(sheet["teleport_destination"][i]).Split('+'); data.m_teleportDestination = new Vector3(float.Parse(desInfo[1]), 0, float.Parse(desInfo[2])); var areaInfo = Convert.ToString(sheet["teleport_area"][i]).Split('+'); data.m_teleportArea = new Vector3(float.Parse(areaInfo[1]), 0, float.Parse(areaInfo[2])); data.m_teleportAngle = Convert.ToSingle(sheet["teleport_angle"][i]); data.m_affect_src = new int[3]; for (int index = 0; index < data.m_affect_src.Length; index++) { data.m_affect_src[index] = Convert.ToInt32(sheet["affect_src" + (index + 1).ToString()][i]); } data.m_affect_prop = new int[3]; for (int index = 0; index < data.m_affect_prop.Length; index++) { data.m_affect_prop[index] = Convert.ToInt32(sheet["affect_prop" + (index + 1).ToString()][i]); } tempList.Add(data); } CreateBulletImpactDataBase(tempList); } } }
public void InitLocalBullet(int bulletID, Int64 entityID, BulletData data, int skillId, long targetId) { BulletData = data; AffectTarget = data.m_affectTarget; //affectTarget; //m_impactData = SkillDataManager.Instance.GetBulletImpactData(data.m_calculateId); BulletID = bulletID; FormEntityID = entityID; BulletIndex = BulletManager.Instance.ReadIndex(entityID); //TraceUtil.Log("==>×???behaviourIndex:" + BulletIndex + " m_bulletId:" + BulletData.m_bulletId + ":" + " entityID: " + entityID + " Time:" + Time.realtimeSinceStartup); m_motionVector = Vector3.zero; m_accelerationVector = Vector3.zero; m_thisTransfrom = this.transform; m_skillId = skillId; m_targetId = targetId; m_impactData = GetBulletImpactData(skillId, data); BattleManager.Instance.BulletBornShakeCamera(BulletData, FormEntityID); // if(!string.IsNullOrEmpty( BulletData.m_bornSfxId) && BulletData.m_bornSfxId != "0") // { // SoundManager.Instance.PlaySoundEffect(BulletData.m_bornSfxId); // } PlayBulletBornSound(BulletData); TypeID type; EntityModel ownerData = EntityController.Instance.GetEntityModel(FormEntityID, out type); m_cachedBeatBackDir = ownerData.GO.transform.TransformDirection(Vector3.forward); if (type == TypeID.TYPEID_PLAYER) { var playerDataStruct = (IPlayerDataStruct)ownerData.EntityDataStruct; m_srcHit = playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_NICETY; m_srcLevel = playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL; m_ownerCampType = (CampType)playerDataStruct.GetUnitValue().sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_FIGHT_HOSTILITY; } else if (type == TypeID.TYPEID_MONSTER) { SMsgPropCreateEntity_SC_Monster monsterData = (SMsgPropCreateEntity_SC_Monster)ownerData.EntityDataStruct; m_srcHit = monsterData.MonsterInvisibleValue.UNIT_FIELD_NICETY; m_srcLevel = monsterData.MonsterUnitValues.UNIT_FIELD_LEVEL; m_ownerCampType = (CampType)monsterData.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY; } if (BulletData.m_breakType == 2) //死亡子弹 存储怪物属性 { var model = MonsterManager.Instance.GetEntityMode(FormEntityID); SMsgPropCreateEntity_SC_Monster monsterProp = (SMsgPropCreateEntity_SC_Monster)model.EntityDataStruct; if (m_impactData.m_damage_type == 1) //普通结算 { m_FightSavePropStruct.byPropNum = 6; m_FightSavePropStruct.nProp = new int[6]; m_FightSavePropStruct.nProp[0] = monsterProp.MonsterInvisibleValue.UNIT_FIELD_ATTACK; m_FightSavePropStruct.nProp[1] = monsterProp.MonsterInvisibleValue.UNIT_FIELD_NICETY; m_FightSavePropStruct.nProp[2] = monsterProp.MonsterInvisibleValue.UNIT_FIELD_BURST; m_FightSavePropStruct.nProp[3] = monsterProp.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY; m_FightSavePropStruct.nProp[4] = monsterProp.MonsterUnitValues.UNIT_FIELD_LEVEL; m_FightSavePropStruct.nProp[5] = monsterProp.MonsterInvisibleValue.UINT_FIELD_DEFBREAK; } else if (m_impactData.m_damage_type == 2) { m_FightSavePropStruct.byPropNum = (byte)m_impactData.m_affect_prop.Length; m_FightSavePropStruct.nProp = new int[m_FightSavePropStruct.byPropNum]; for (int i = 0; i < m_FightSavePropStruct.byPropNum; i++) { if (m_impactData.m_affect_src[i] == 1) { //int propIndex = CommonDefineManager.Instance.GetPropKey(m_impactData.m_affect_prop[i]); int propIndex = PlayerDataManager.Instance.GetPropID(m_impactData.m_affect_prop[i]); if (propIndex == -1) { Debug.LogError("PlayerPropParam.xml is not exit " + m_impactData.m_affect_prop[i]); continue; } m_FightSavePropStruct.nProp[i] = monsterProp.GetValue(propIndex); } else { m_FightSavePropStruct.nProp[i] = 0; } } } } }