Example #1
0
    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);
    }
Example #2
0
 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();
         }
     });
 }
Example #3
0
    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);
            }
        });
    }