public bool Guilty(CollisionCase c) { if (!c.Offender.IsControllable) return false; var vec = world.Engine.GetAbsoluteLocation(c.Victim.ObjectId) - world.Engine.GetAbsoluteLocation(c.Offender.ControlledObjectId); var velocity = world.Engine.GetSpeed(c.Offender.ControlledObjectId); return vec.X * velocity.X + vec.Y * velocity.Y > 0; }
public bool Guilty(CollisionCase c) { if (!c.Offender.IsControllable) { return(false); } var engine = world.GetEngine <ICommonEngine>(); var vec = engine.GetAbsoluteLocation(c.Victim.ObjectId) - engine.GetAbsoluteLocation(c.Offender.ControlledObjectId); var velocity = engine.GetSpeed(c.Offender.ControlledObjectId); return(vec.X * velocity.X + vec.Y * velocity.Y > 0); }