コード例 #1
0
        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]);
        }
コード例 #2
0
        public override void Apply(GameStateMatch g, Player p)
        {
            const float duration = 8.0f;

            float angle = (float)(2 * Math.PI * yPhysics.Random());
            float len   = 7.0f;

            for (int i = 0; i < 4; i++)
            {
                g.newBall(Vector3.Zero, new Vector3(len * (float)Math.Cos(angle + i * Math.PI / 2), len * (float)Math.Sin(angle + i * Math.PI / 2), 0), (int)(duration * yPhysics.Instance.fps));
            }
        }