private void HandleBallFallen(object sender, BallEventArgs e) { var ball = balls.Single(b => b.gameObject == e.GameObject); balls.Remove(ball); Destroy(ball.gameObject); }
public void HitTheBall(BallEventArgs e) { if (hitBallCallback == null) { return; } hitBallCallback(e); }
public void HitTheBall(BallEventArgs e) { if(hitBallCallback!=null){ Debug.Log("Hit the ball"); hitBallCallback(e); } }
public void OnBallInPlay(BallEventArgs e) { EventHandler ballInPlay=BallInPlay; Debug.Log(ballInPlay); if(ballInPlay!=null) ballInPlay(this,e); }
private void Ball_PassedThroughRing(object sender, BallEventArgs e) { if (!e.BallOnRightSide && e.LastPlayerToTouchBall.tag == "PlayerOne") { ScorePoint(e.LastPlayerToTouchBall.tag, playerOne = maxScore); } else if (e.BallOnRightSide && e.LastPlayerToTouchBall.tag == "PlayerTwo") { ScorePoint(e.LastPlayerToTouchBall.tag, playerTwo = maxScore); } }
private void Ball_StoppedMoving(object sender, BallEventArgs e) { if (e.BallOnRightSide) { ScorePoint("PlayerOne", ++playerOne); NextRound?.Invoke("PlayerOne"); } else { ScorePoint("PlayerTwo", ++playerTwo); NextRound?.Invoke("PlayerTwo"); } }
protected override void BallInPlayEventHandler(object sender, EventArgs e) { if (e is BallEventArgs) { BallEventArgs ballEventArgs = e as BallEventArgs; if (ballEventArgs.Angle < 45 && ballEventArgs.Distance < 300) { this.CatchBall(); } else { this.ProtectFirstBase(); } } }
public void HitTheBall(BallEventArgs e) { if (hitBallCallback != null) { StringBuilder listeners = new StringBuilder(); listeners.Append($"\n HitTheBallEvent listeners: {hitBallCallback.GetInvocationList().Length}"); foreach (var element in hitBallCallback.GetInvocationList()) { listeners.Append($"\n {element.Target.GetType().Name}"); } Console.WriteLine(listeners); hitBallCallback(e); } else { Console.WriteLine("Delegate hitBallCallback have not listeners"); } }
private void PointScored(object sender, BallEventArgs e) { PlayAudio(2); }