EffectMessage MakeEffect(Entity p) { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { p.OnMessage(Player.Message.Damage); Mixer.SawHit.Play(); }; return(new EffectMessage(this, callback)); }
public override EffectMessage MakeEffect() { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { to.AddComponent(new Freeze(to.X, to.Y, Lifetime)); }; FP.Log("FROZEN FOR ", Lifetime, " SECONDS YO"); return(new EffectMessage(owner, callback)); }
public override EffectMessage MakeEffect() { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { if (to == from) { return; // sender; } to.AddComponent(new SuperSpeedEmitter(Lifetime)); to.OnMessage(Movement.Message.Speed, NewSpeed); }; return(new EffectMessage(owner, callback)); }
public override EffectMessage MakeEffect() { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { if (to == from) { return; // sender; } var dir = new Point(to.X - from.X, to.Y - from.Y); dir.Normalize(MagnetStrength); to.OnMessage(PhysicsBody.Message.Impulse, -dir.X, -dir.Y); }; return(new EffectMessage(owner, callback)); }
private EffectMessage MakeEffect(MessageResult result) { EffectMessage.Callback callback = delegate(Entity to, Entity from, float scalar) { if (from != null) // hit { from.OnMessage(Player.Message.Damage); } else // rebound { result.Value = true; } }; return(new EffectMessage(null, callback)); }
public override EffectMessage MakeEffect() { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { if (to == from) { return; // sender; } if (to.CollideRect(to.X, to.Y, from.X - SmashRadius, from.Y - 10, SmashRadius * 2, 10)) { to.OnMessage(Player.Message.Damage); } }; return(new EffectMessage(owner, callback)); }
protected EffectMessage MakeEffect(Player player) { EffectMessage.Callback callback = delegate(Entity from, Entity to, float scalar) { canPunch = false; from.OnMessage(Fist.Message.PunchSuccess, player); World.BroadcastMessage(Player.Message.Hit, from, to); World.BroadcastMessage(CameraManager.Message.Shake, 10.0f, 0.5f); Mixer.Hit1.Play(); if (FP.Sign(from.X - to.X) == FP.Sign(forceVector.X)) { forceVector *= -1; } var force = ForceMultiplier * BASE_PUNCH_FORCE * scalar; to.OnMessage(Message.PunchConnected); to.OnMessage(PhysicsBody.Message.Impulse, force * forceVector.X, force * forceVector.Y); }; return(new EffectMessage(parent, callback)); }