Exemplo n.º 1
0
        /// <summary>
        /// Creates a new ball hit.
        /// </summary>
        /// <param name="ball">Reference to ball</param>
        /// <param name="data">data Static ball data</param>
        /// <param name="state">Dynamic ball state</param>
        /// <param name="initialVelocity">Initial velocity</param>
        /// <param name="tableData">Table data</param>
        public BallHit(Ball ball, BallData data, BallState state, Vertex3D initialVelocity, TableData tableData) : base(ItemType.Ball)
        {
            _id        = data.Id;
            _data      = data;
            _state     = state;
            _tableData = tableData;
            _mover     = new BallMover(state, this);

            // Only called by real balls, not temporary objects created for physics/rendering
            InvMass = 1.0f / data.Mass;
            Inertia = 2.0f / 5.0f * data.Radius * data.Radius * data.Mass;
            Vel     = initialVelocity;
            Coll    = new CollisionEvent(ball);

            _state.IsFrozen = false;

            if (initialVelocity != null)
            {
                CalcHitBBox();
            }
        }
Exemplo n.º 2
0
 public BallMover(BallState state, BallHit hit)
 {
     _state = state;
     _hit   = hit;
 }
Exemplo n.º 3
0
 public Ball(BallData data, BallState state, Vertex3D initialVelocity, Player player, Table.Table table)
 {
     Data  = data;
     State = state;
     Hit   = new BallHit(this, data, state, initialVelocity, table.Data);
 }