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]); }
public override void Apply(GameStateMatch g, Player p) { if ((p.thePad.Center.X < 0 && p.thePad.Center.X > -g.theLevel.SizeX / 2 && g.isPlayer1(p)) || (p.thePad.Center.X > 0 && p.thePad.Center.X < g.theLevel.SizeX / 2 && !g.isPlayer1(p))) { p.thePad.setCenter(p.thePad.Center + (g.isPlayer1(p) ? +1 : -1) * Vector3.UnitX * g.theLevel.SizeX / 2); } }
public override void Apply(GameStateMatch g, Player p) { Player target = g.isPlayer1(p) ? g.Player2 : g.Player1; g.theEvents.addEvent(new GameEventPlayerChangeFriction(6.0f, target, target.thePad.FrictionConstant)); target.thePad.FrictionConstant = 4 * target.thePad.FrictionConstant; }
public override void Apply(GameStateMatch g, Player p) { bool isp1 = g.isPlayer1(p); Pad thepad = g.Pads[isp1 ? 0 : 1]; thepad.F += movement; }
public override void Apply(GameStateMatch g, Player p) { bool isp1 = g.isPlayer1(p); foreach (Ball b in g.Balls) { if (b.Speed.X * (isp1 ? +1 : -1) > 0) { b.setSpeed(new Vector3(-b.Speed.X, b.Speed.Y, b.Speed.Z)); } } }
public override void Apply(GameStateMatch g, Player p) { const float lendiff = 1.2f; const float F = 60.0f; bool isp1 = g.isPlayer1(p); Vector3 pmin = new Vector3(p.thePad.MaxPoint.X - g.theLevel.SizeX, p.thePad.MinPoint.Y - lendiff * p.thePad.Size.Y, p.thePad.MinPoint.Z); Vector3 pmax = new Vector3(p.thePad.MaxPoint.X, p.thePad.MaxPoint.Y + lendiff * p.thePad.Size.Y, p.thePad.MaxPoint.Z); FieldEventForceConst fe = new FieldEventForceConst(new Vector3((isp1 ? -1 : +1) * F, 0, 0)); g.theFieldlist.addField(new FieldBox(1.0f, fe, fe, fe, pmin, pmax)); }
public override void Apply(GameStateMatch g, Player p) { const float lendiff = 1.2f; bool isp1 = g.isPlayer1(p); Vector3 pmin = new Vector3(p.thePad.MaxPoint.X - g.theLevel.SizeX, p.thePad.MinPoint.Y - lendiff * p.thePad.Size.Y, p.thePad.MinPoint.Z); Vector3 pmax = new Vector3(p.thePad.MaxPoint.X, p.thePad.MaxPoint.Y + lendiff * p.thePad.Size.Y, p.thePad.MaxPoint.Z); FieldEventInvisible finside = new FieldEventInvisible(); FieldEventVisible finexit = new FieldEventVisible(); g.theFieldlist.addField(new FieldRadial(6.0f, finside, finexit, finside, Vector3.Zero, g.theLevel.SizeY / 3)); }
public override void Apply(GameStateMatch g, Player p) { /* * foreach (Ball b in g.Balls) * { * if ((b.Center.X > 0 && b.Center.X < g.theLevel.SizeX / 2 && g.isPlayer1(p)) || (b.Center.X < 0 && b.Center.X > -g.theLevel.SizeX / 2 && !g.isPlayer1(p))) * { * b.Center = new Vector3(-b.Center.X, b.Center.Y, b.Center.Z); * b.Speed = new Vector3(-b.Speed.X, b.Speed.Y, b.Speed.Z); * } * }*/ bool p1 = g.isPlayer1(p); Player target = p1 ? g.Player2 : g.Player1; const float border = 1.2f; float randx = (p1?-1:+1) * g.theLevel.SizeX / 4 + 2 * (yPhysics.Random() - 1) * (g.theLevel.SizeX / 2 - target.thePad.Size.X / 2 - border); float randy = +2 * (yPhysics.Random() - 1) * (g.theLevel.SizeY / 2 - target.thePad.Size.Y / 2 - border); Ball b = create_ball_for(g, p, 3.0f, new GameEventTeleportInOwnSpace(0, target, g)); }
public override void Apply(GameStateMatch g, Player p) { float duration = 3.0f; float angle = (float)(-Math.PI / 4 + Math.PI / 2 * yPhysics.Random()) + (float)Math.PI * (g.isPlayer1(p) ? 0 : 1); for (int i = 0; i < 2; i++) { Ball b = create_ball_for(g, p, duration); float len = b.Speed.Length / 1.5f; b.setSpeed(new Vector3(-len * (float)Math.Cos(angle), len * (float)Math.Sin(angle), 0)); angle *= -1; } }
public override void Apply(GameStateMatch g, Player p) { g.theEvents.addHot_or_Dot(g.isPlayer1(p) ? g.Player2 : g.Player1, 6, -2); }
public override PongMove GetInput(GameStateMatch game, Player player, Character c, int[] cooldowns, KeyboardDevice k, int time) { return(AI.SuggestForce(game.isPlayer1(player) ? 0 : 1, game.theLevel, game.Balls, game.Pads[game.isPlayer1(player) ? 0 : 1])); }
public override void Apply(GameStateMatch g, Player p) { bool p1 = g.isPlayer1(p); Player target = p1 ? g.Player2 : g.Player1; Ball b = create_ball_for(g, p, 3.0f, new GameEventSlowForPeriod(0, target, g, 24.0f)); }
public override void Apply(GameStateMatch g, Player p) { Ball b = create_ball_for(g, p, 10.0f); float len = b.Speed.Length / 1.5f; float angle = (float)(-Math.PI / 4 + Math.PI / 2 * yPhysics.Random()) + (float)Math.PI * (g.isPlayer1(p) ? 0 : 1); b.setSpeed(new Vector3(-len * (float)Math.Cos(angle), len * (float)Math.Sin(angle), 0)); foreach (Ball ba in g.Balls) { if (ba.Age < yPhysics.Instance.fps * 10.0f && ba.Age >= 0) { ba.Age = (int)(yPhysics.Instance.fps * 10.0f); } } }
public override void Apply(GameStateMatch g, Player p) { Ball b = create_ball_for(g, p, 10); float len = b.Speed.Length / 1.5f; float angle = (float)(-Math.PI / 4 + Math.PI / 2 * yPhysics.Random()) + (float)Math.PI * (g.isPlayer1(p) ? 0 : 1); b.setSpeed(new Vector3(-len * (float)Math.Cos(angle), len * (float)Math.Sin(angle), 0)); }
public Pad createPad(GameStateMatch g, int appnumber) { return(new Pad(g.theLevel, g.isPlayer1(this) ? 0 : 1, character.DefaultAppearance)); }