public void newBall(Vector3 center, Vector3 speed, int duration, GameEventModifyPlayer onhit_event) { Ball[] newballs = new Ball[balls.Length + 1]; for (int b = 0; b < balls.Length; b++) { newballs[b] = balls[b]; } newballs[balls.Length] = onhit_event == null ? new Ball(duration) : new BastardBall(onhit_event, duration); newballs[balls.Length].setCenter(center); newballs[balls.Length].setSpeed(speed); balls = newballs; }
public BastardBall(GameEventModifyPlayer _event, int age) : base(age) { theevent = _event; }
public BastardBall(GameEventModifyPlayer _event) : base() { theevent = _event; }
protected static Ball create_ball_for(GameStateMatch g, Player p, float duration, GameEventModifyPlayer onball_hit) { bool isp1 = g.isPlayer1(p); g.newBall(p.thePad.Center + Vector3.UnitX * (isp1 ? -1 : +1) * g.Balls[0].Size.X, Vector3.UnitX * (isp1 ? -1 : +1) * Ball.TypicalSpeed * 2.1f, (int)(duration * yPhysics.Instance.fps), onball_hit); return(g.Balls[g.Balls.Length - 1]); }