基因窃贼

This commit is contained in:
Tourswen
2025-10-22 01:02:33 +08:00
parent fc9bd81f88
commit 88000aa1ca
25 changed files with 1060 additions and 52 deletions

View File

@@ -9,6 +9,11 @@ namespace ArachnaeSwarm
public float cleaveDamageFactor = 0.7f;
public bool damageDowned = false;
public DamageDef explosionDamageDef = null;
// 新增:攻击特效
public EffecterDef attackEffecter = null;
public EffecterDef cleaveEffecter = null;
public SoundDef attackSound = null;
public CompProperties_Cleave()
{
@@ -20,4 +25,4 @@ namespace ArachnaeSwarm
{
public CompProperties_Cleave Props => (CompProperties_Cleave)this.props;
}
}
}

View File

@@ -26,6 +26,9 @@ namespace ArachnaeSwarm
DamageWorker.DamageResult result = new DamageWorker.DamageResult();
// 播放攻击特效
PlayAttackEffecter(target);
// 1. 对主目标造成伤害
DamageInfo dinfo = new DamageInfo(
this.verbProps.meleeDamageDef,
@@ -104,6 +107,45 @@ namespace ArachnaeSwarm
return result;
}
/// <summary>
/// 播放攻击特效
/// </summary>
private void PlayAttackEffecter(LocalTargetInfo target)
{
if (this.CasterPawn == null || this.CasterPawn.Map == null)
return;
// 播放攻击特效
if (this.Comp.Props.attackEffecter != null)
{
Effecter attackEffect = this.Comp.Props.attackEffecter.Spawn();
attackEffect.Trigger(new TargetInfo(this.CasterPawn.Position, this.CasterPawn.Map), target.ToTargetInfo(this.CasterPawn.Map));
attackEffect.Cleanup();
}
// 播放溅射特效
if (this.Comp.Props.cleaveEffecter != null && target.HasThing)
{
PlayCleaveEffecter(target.Thing);
}
}
/// <summary>
/// 播放溅射特效
/// </summary>
private void PlayCleaveEffecter(Thing mainTarget)
{
if (this.CasterPawn == null || this.CasterPawn.Map == null || mainTarget == null)
return;
Pawn casterPawn = this.CasterPawn;
// 播放主要的溅射特效
Effecter cleaveEffect = this.Comp.Props.cleaveEffecter.Spawn();
cleaveEffect.Trigger(new TargetInfo(casterPawn.Position, casterPawn.Map), new TargetInfo(mainTarget.Position, casterPawn.Map));
cleaveEffect.Cleanup();
}
private void CreateCleaveExplosion(Pawn caster, Thing target, float radius, float angle)
{
if (caster.Map == null || this.Comp.Props.explosionDamageDef == null) return;
@@ -177,4 +219,4 @@ namespace ArachnaeSwarm
}).ToList();
}
}
}
}