Пример #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();
            }
        }
Пример #2
0
 public Ball(BallData data, Vertex3D initialVelocity, Table.Table table)
 {
     Data = data;
 }
Пример #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);
 }