public override void Explode() { ErrorHandler.Parse( SkillDetails.CreateCreationAround(mBullet.FirerAttr, mBullet.CreationOnArrive, mBullet.GetPosition(), mBullet.GetDirection()), "failed to create creature on bullet arrived" ); // 爆炸特效, 仅在子弹到达终点时播放, 即, 子弹没有命中足够的人. if (mBullet.CurrentHittedCount < mBullet.MaxHitCount) { SkillClientBehaviour.AddSceneEffect(mBullet.ExplodeEffect, mBullet.GetPosition(), mBullet.GetDirection()); } // 用碰撞来模拟爆炸, 从而使得技能效果的方向沿着子弹的飞行方向. if (mBullet.TargetSelectionOnArrive != uint.MaxValue && mBullet.SkillEffectOnArrive != uint.MaxValue) { TargetSelectionTableItem targetSel = DataManager.TargetSelectionTable[mBullet.TargetSelectionOnArrive] as TargetSelectionTableItem; ArrayList targets = SkillUtilities.SelectTargets(mBullet.FirerAttr, mBullet.GetPosition(), mBullet.GetDirection(), targetSel); AttackerAttr other = mBullet.FirerAttr; other.SetEffectStartLocation(mBullet.GetPosition(), mBullet.GetDirection()); foreach (BattleUnit t in targets) { SkillDetails.AddSkillEffectByResource(other, t, mBullet.SkillEffectOnArrive); } } }
protected override void onDie(AttackerAttr attackerAttr, ImpactDamageType impactDamageType) { SkillDetails.SelectTargetAndAddSkillEffect(mSummonerAttr, GetPosition(), GetDirection(), mTrapResource.targetSelectionOnExplode, mTrapResource.skillEffectOnExplode ); SkillClientBehaviour.AddSceneEffect(mTrapResource._3DEffectOnExplode, GetPosition()); base.onDie(attackerAttr, impactDamageType); }
public override void Explode() { ErrorHandler.Parse( SkillDetails.CreateCreationAround(mBullet.FirerAttr, mBullet.CreationOnArrive, mBullet.GetPosition(), mBullet.GetDirection()), "failed to create creature on bullet arrived" ); SkillClientBehaviour.AddSceneEffect(mBullet.ExplodeEffect, mBullet.GetPosition(), mBullet.GetDirection()); // 检查该种子弹是否可以产生爆炸伤害. SkillDetails.SelectTargetAndAddSkillEffect( mBullet.FirerAttr, mBullet.GetPosition(), mBullet.GetDirection(), mBullet.TargetSelectionOnArrive, mBullet.SkillEffectOnArrive ); }
/// <summary> /// 添加材质特效和声音. /// </summary> /// <param name="owner">被添加特效和声音的单位</param> /// <param name="cdContainer">cd的容器, 该函数会检查并设置CD.</param> /// <param name="name">添加的类型(被击, 死亡等)</param> /// <param name="impactDamageType">impact的伤害类型</param> public static ErrorCode AddMaterialBehaviour(BattleUnit owner, HitMaterialEffectCdContainer cdContainer, MaterialBehaviourDef name, ImpactDamageType impactDamageType, float dir ) { // 无效的伤害类型. if (impactDamageType >= ImpactDamageType.Count) { return(ErrorCode.Succeeded); } // CD中, 只有被击的材质特效有CD, 死亡材质特效没有CD. if (name == MaterialBehaviourDef.OnMaterialBeHit && cdContainer.IsCoolingDown(impactDamageType)) { return(ErrorCode.CoolingDown); } uint materialID = owner.GetMaterialResourceID(); if (materialID == uint.MaxValue) { ErrorHandler.Parse(ErrorCode.ConfigError, owner.dbgGetIdentifier() + " 没有材质!"); return(ErrorCode.ConfigError); } MaterialTableItem material = DataManager.MaterialTable[materialID] as MaterialTableItem; if (material == null) { SkillUtilities.ResourceNotFound("material", materialID); return(ErrorCode.ConfigError); } if (name == MaterialBehaviourDef.OnMaterialBeHit) { cdContainer.StartCd(impactDamageType); } MaterialItem item = material.items[(int)impactDamageType]; uint effectID = uint.MaxValue; uint sound = uint.MaxValue; string bindpoint = ""; switch (name) { case MaterialBehaviourDef.OnMaterialBeHit: effectID = item.hitEffect; bindpoint = material.hitEffectBindpoint; sound = item.sound; // 被击材质特效在被击者身上播放. /* SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir);*/ if (string.IsNullOrEmpty(bindpoint)) { SkillClientBehaviour.AddSceneEffect(effectID, owner.GetPosition(), dir); } else { SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir); } break; case MaterialBehaviourDef.OnMaterialDie: effectID = item.deathEffect; bindpoint = material.deathEffectBindpoint; if (string.IsNullOrEmpty(bindpoint)) { SkillClientBehaviour.AddSceneEffect(effectID, owner.GetPosition(), dir); } else { SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir); } break; default: break; } if (sound != uint.MaxValue) { SkillClientBehaviour.PlaySound(sound); } return(ErrorCode.Succeeded); }