protected void CheckCollision(PointNode newPointNode) { if (newPointNode.State != NodeStates.Free) { var e = new CollisionHappenedEventArgs(newPointNode); OnCollisionHandler(e); } }
public static void OnCollisionHappend(object sender, CollisionHappenedEventArgs e) { Snake snake = (Snake)sender; if (SnakeIsPickedUpItem(e.Node)) { GrowSnakeAndRemoveItem(snake, e.Node); } else { KillSnake(snake); } }
protected virtual void OnCollisionHandler(CollisionHappenedEventArgs e) => CollisionHappened?.Invoke(this, e);