void TryDash(Movement movement, ActorComponent actor) { movement.velocity.x = (-movement.velocity.x) + Mathf.Sign(movement.velocity.x) * 30f; movement.velocity.y -= movement.velocity.y; var e = new DashEvent(actor.guid, movement.velocity); EgoEvents <DashEvent> .AddEvent(e); }
void Handle(DashEvent e) { constraint.ForEachGameObject((egoComponent, sfx, actor) => { if (actor.guid == e.actorGuid) { sfx.dashSound.pitch = Random.Range(0.9f, 1.1f); sfx.dashSound.Play(); } }); }
void Handle(DashEvent e) { var emitParams = new ParticleSystem.EmitParams(); emitParams.velocity = -e.velocity.normalized * 4f; constraint.ForEachGameObject((egoComponent, jumpParticle, actor) => { if (actor.guid == e.actorGuid) { jumpParticle.ps.Emit(emitParams, 3); } }); }