public void UpdateViaNotify(object inotifyArgs)//设置各种属性 { EntityDataUpdateNotify entityDataUpdateNotify = (EntityDataUpdateNotify)inotifyArgs; if (entityDataUpdateNotify.nEntityClass == TypeID.TYPEID_MONSTER) { SMsgPropCreateEntity_SC_Monster monster = (SMsgPropCreateEntity_SC_Monster)MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).EntityDataStruct; PlayCutBloodAnimation(monster.UID); //更新血量 if (MonsterManager.Instance.IsMonsterBossType(monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID)) { if (ShardProgressBar == null) { //防守副本防甲为空 return; } int bossShard = monster.MonsterUnitValues.UNIT_FIELD_SHARD; float shardValue = (float)bossShard / BattleConfigManager.Instance.MonsterConfigList[monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID].m_shieldpoint; //ShardProgressBar.fillAmount = shardValue; //防护值恢复特效 if (m_previousshardValue == 0 && bossShard >= BattleConfigManager.Instance.MonsterConfigList[monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID].m_shieldpoint) { PlayRecoverProtectionEff(); } m_previousshardValue = bossShard; TweenFloat.Begin(0.3f, ShardProgressBar.fillAmount, shardValue, ChangeShardProgressBar); if (IsShowStatusLabel) { ShardNumLabel.text = string.Format("{0}/{1}", bossShard, BattleConfigManager.Instance.MonsterConfigList[monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID].m_shieldpoint); } else { ShardNumLabel.text = ""; } if (shardValue <= 0) { PlayerShardEffect(monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID); MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).GO.GetComponent <HurtFlash>().OnDisrupt(true); } else { MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).GO.GetComponent <HurtFlash>().OnDisrupt(false); ShardProgressBar.enabled = true; ShardBarFrame.enabled = true; m_isFlag = true; } } } }
void FireBulletHandle(int bulletID, bool useFirePos) { SMsgPropCreateEntity_SC_Monster mData = (SMsgPropCreateEntity_SC_Monster)m_MonsterBehaviour.EntityModel.EntityDataStruct; CampType ct = (CampType)(mData.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY); if (useFirePos) { BulletFactory.Instance.CreateBullet(bulletID, m_MonsterBehaviour.RoleDataModel.SMsg_Header.uidEntity, m_MonsterBehaviour.ThisTransform, m_rangeTypePos, m_currentSkillBase.SkillData.m_skillId, m_FightTargetID); } else { BulletFactory.Instance.CreateBullet(bulletID, m_MonsterBehaviour.RoleDataModel.SMsg_Header.uidEntity, m_MonsterBehaviour.ThisTransform, m_currentSkillBase.SkillData.m_skillId, m_FightTargetID); } }
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; } }
public static SMsgPropCreateEntity_SC_Monster ParsePackage(Package package, int offset) { var structLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Monster)); var headLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Header)); var offsetBuffer = package.Data.Skip(offset).Take(structLength).ToArray(); SMsgPropCreateEntity_SC_Monster sMsgPropCreateEntity_SC_Monster = new SMsgPropCreateEntity_SC_Monster(); sMsgPropCreateEntity_SC_Monster.m_sMsg_Header = SMsgPropCreateEntity_SC_Header.ParsePackage(package, offset); int of = headLength; of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.UID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MapID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MonsterX); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MonsterY); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.Name, 19); byte[] baseValues, monsterUnitValues, monsterInvisibleValue, monsterValues; int baseValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_BaseValue>(); int unitVisibleValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_UnitVisibleValue>(); int unitInvisibleValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_UnitInvisibleValue>(); int monsterValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_MonsterValue>(); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out baseValues, baseValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterUnitValues, unitVisibleValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterInvisibleValue, unitInvisibleValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterValues, monsterValueSize); sMsgPropCreateEntity_SC_Monster.BaseObjectValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_BaseValue>(baseValues); sMsgPropCreateEntity_SC_Monster.MonsterUnitValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_UnitVisibleValue>(monsterUnitValues); sMsgPropCreateEntity_SC_Monster.MonsterInvisibleValue = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_UnitInvisibleValue>(monsterInvisibleValue); sMsgPropCreateEntity_SC_Monster.MonsterValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_MonsterValue>(monsterValues); //TraceUtil.Log("PlayerSpeed:" + sMsgPropCreateEntity_SC_Monster.MonsterUnitValues.UNIT_FIELD_SPEED + " " + sMsgPropCreateEntity_SC_Monster.MonsterUnitValues.UNIT_FIELD_SHARD); return(sMsgPropCreateEntity_SC_Monster); }
public void UpdateViaNotify(object inotifyArgs) //设置各种属性 { EntityDataUpdateNotify entityDataUpdateNotify = (EntityDataUpdateNotify)inotifyArgs; //if (entityDataUpdateNotify.nEntityClass == TypeID.TYPEID_MONSTER) if (m_BossUID == entityDataUpdateNotify.EntityUID) { SMsgPropCreateEntity_SC_Monster monster = (SMsgPropCreateEntity_SC_Monster)MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).EntityDataStruct; PlayCutBloodAnimation(monster.UID); //更新血量 //更新防护值 if (MonsterManager.Instance.IsMonsterBossType(monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID)) { if (ShardProgressBar == null) { //防守副本防甲为空 return; } MonsterConfigData monsterConfig = BattleConfigManager.Instance.MonsterConfigList[monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID]; int bossShard = monster.MonsterUnitValues.UNIT_FIELD_SHARD; float shardValue = 0; if (monsterConfig.m_shieldpoint == 0) { shardValue = 0; } else { shardValue = bossShard / monsterConfig.m_shieldpoint; } if (shardValue <= 0) { if (monsterConfig.m_shieldpoint > 0) //防护值最大值为0的怪没有防护 { //StartCoroutine("BreakDefenseTipAppear",BreakDefenseTipAppearDelay); //PlayerShardEffect(monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID); MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).GO.GetComponent <HurtFlash>().OnDisrupt(true); } } else { MonsterManager.Instance.GetEntityMode(entityDataUpdateNotify.EntityUID).GO.GetComponent <HurtFlash>().OnDisrupt(false); // ShardProgressBar.enabled = true; // ShardBarFrame.enabled = true; // m_isFlag = true; } //=====显示防护值 如果是多boss,显示并仅显示一个存活boss的防护值 SMsgPropCreateEntity_SC_Monster showMonster = monster; if (m_BossModelDic.Count > 1) { var bossModelArray = m_BossModelDic.Values.ToArray(); for (int i = 0; i < bossModelArray.Length; i++) { showMonster = (SMsgPropCreateEntity_SC_Monster)bossModelArray[i].EntityDataStruct; if (showMonster.MonsterUnitValues.UNIT_FIELD_CURHP > 0) { break; } } } MonsterConfigData showMonsterConfig = BattleConfigManager.Instance.MonsterConfigList[showMonster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID]; int showBossShard = showMonster.MonsterUnitValues.UNIT_FIELD_SHARD; float showShardValue = 0; if (showMonsterConfig.m_shieldpoint == 0) { showShardValue = 0; } else { showShardValue = showBossShard / showMonsterConfig.m_shieldpoint; } //防护值恢复特效 if (m_previousshardValue == 0 && showBossShard >= showMonsterConfig.m_shieldpoint) { if (showMonsterConfig.m_shieldpoint > 0) { StopCoroutine("BreakDefenseTipAppear"); BreakDefenseTip.SetActive(false); PlayRecoverProtectionEff(); } } m_previousshardValue = showBossShard; //防护值减少动画 TweenFloat.Begin(0.3f, ShardProgressBar.fillAmount, showShardValue, ChangeShardProgressBar); if (IsShowStatusLabel) { ShardNumLabel.text = string.Format("{0}/{1}", showBossShard, BattleConfigManager.Instance.MonsterConfigList[showMonster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID].m_shieldpoint); } else { ShardNumLabel.text = ""; } if (showShardValue <= 0) { if (showMonsterConfig.m_shieldpoint > 0) //防护值最大值为0的怪没有防护 { if (!MonsterManager.Instance.IsDoubleBoss) //双boss血条情况下不显示 可击倒提示 { StartCoroutine("BreakDefenseTipAppear", BreakDefenseTipAppearDelay); } PlayerShardEffect(monster.BaseObjectValues.OBJECT_FIELD_ENTRY_ID); } } else { ShardProgressBar.enabled = true; ShardBarFrame.enabled = true; m_isFlag = true; } } } }
private void ImpactTargetMonster(EntityModel monster, EntityModel ownerData, int affectTarget, int srcLevel, int srcHit) { MonsterBehaviour mBehavior = (MonsterBehaviour)monster.Behaviour; SMsgPropCreateEntity_SC_Monster mData = (SMsgPropCreateEntity_SC_Monster)monster.EntityDataStruct; int destLevel = mData.MonsterUnitValues.UNIT_FIELD_LEVEL; int destMiss = mData.MonsterInvisibleValue.UNIT_FIELD_JOOK; bool monsterProtected = (mData.MonsterInvisibleValue.UINT_FILED_PROTECTED == 1); CampType monsterCampType = (CampType)(mData.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY); if ((AffectTarget == 1 && monsterCampType != m_ownerCampType) || //作用于敌方阵营,子弹和目标怪物阵营不一致 (AffectTarget == 2 && monsterCampType == m_ownerCampType) || //作用于己方阵营,子弹和目标怪物阵营一致 AffectTarget == 3 || //所有 AffectTarget == 6) { if (IsInShape(monster.GO.transform.position)) { if (!mBehavior.IsDie && (!(mBehavior.Invincible || monsterProtected)) ) { if (m_ownerCampType == monsterCampType || IsHit(srcLevel, destLevel, srcHit, destMiss)) { SendFightEffect(monster.EntityDataStruct.SMsg_Header.uidEntity); if (EctGuideManager.Instance.IsEctypeGuide) { //发出命中消息,目前在副本引导里会进行命中后减速检测 RaiseEvent(EventTypeEnum.HitMonsterForGuide.ToString(), new BulletHitData() { BulletId = BulletID, BeFightId = mData.BaseObjectValues.OBJECT_FIELD_ENTRY_ID }); } EntityController.Instance.ShowHurtEffect(monster, (uint)BulletID, FormEntityID); EntityController.Instance.ShowHurtUiEffect(ownerData, (uint)BulletID); //新增 移除怪物 结算 if (m_impactData.m_damage_type == 3) { DoDestroySelf(); return; } if (m_impactData.m_beatBackSpeed == 0 && m_impactData.m_beatBackAcceleration == 0 && m_impactData.m_beatBackDuration != 0) { bool noneFreeze = false; if (mBehavior.FSMSystem.CurrentStateID == StateID.MonsterAttack) { MonsterAttackState attackState = ((MonsterAttackState)mBehavior.FSMSystem.CurrentState); noneFreeze = attackState.CurrentSkillBase != null && attackState.CurrentSkillBase.OnFire && attackState.CurrentSkillBase.CurrentActionThresHold == CommonDefineManager.Instance.CommonDefine.NoneFreezeIronLevel; } //horde if (!noneFreeze) { Horde(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position); } } else if (mData.MonsterUnitValues.UNIT_FIELD_SHARD == 0 && !mBehavior.IronBody && mData.MonsterInvisibleValue.UNIT_FIELD_ARMOR != 1) //shield broke { Vector3 beatBackDir = Vector3.zero; if (ownerData == null) //怪物实体不存在的情况 (死亡子弹) { beatBackDir = GetBeatBackDir(monster.GO.transform, monster.GO.transform); } else { beatBackDir = GetBeatBackDir(ownerData.GO.transform, monster.GO.transform); } if (m_impactData.m_beatFlyLevel > 0) { //fly BeatFly(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir); } else if (m_impactData.m_beatBackLevel > 0) { if (m_impactData.m_beatBackDir == 6) { //absord Absord(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir); } else { //beat back BeatBack(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir); } } } if (BulletData.m_overParam == 2) { DoDestroySelf(); } } else { Miss(monster.EntityDataStruct.SMsg_Header.uidEntity); if (AffectTarget == 6) //只结算一次 { DoDestroySelf(); } } } } } }
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; } } } } }