Skip to content

Commit

Permalink
EventHandler -> Action
Browse files Browse the repository at this point in the history
  • Loading branch information
valkyrienyanko committed Mar 10, 2023
1 parent 0bfb4ab commit d2bac3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class SlimeAnimationPreJumpStart : EntityAnimation<Slime>

public override void Enter()
{
Entity.Jump += Slime_Jump;
Entity.Jump += SlimeJump;

Entity.AnimatedSprite.Play("pre_jump_start");
}
Expand All @@ -20,10 +20,10 @@ public override void Update()

public override void Exit()
{
Entity.Jump -= Slime_Jump;
Entity.Jump -= SlimeJump;
}

private void Slime_Jump(object sender, EventArgs e)
private void SlimeJump()
{
SwitchState(EntityAnimationType.JumpStart);
}
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Entities/MovingEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public abstract partial class MovingEntity<T> : CharacterBody2D, IMovingEntity w
protected int DamageTakenForce { get; set; } = 300;
private bool TouchedGroundBool { get; set; }

public event EventHandler Jump;
public event Action Jump;

public sealed override void _Ready()
{
Expand Down Expand Up @@ -263,7 +263,7 @@ public virtual void RemoveHealth(int v)

protected virtual void OnJump() // code smell?
{
Jump?.Invoke(this, EventArgs.Empty);
Jump?.Invoke();
}

private void OnImmunityTimerFinished()
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Entities/Player/Animations/PlayerAnimationIdle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override void Enter()
Entity.Jump += OnJump;
}

private void OnJump(object sender, EventArgs e)
private void OnJump()
{

}
Expand Down

0 comments on commit d2bac3b

Please sign in to comment.