Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhysicsFactory"/> class.
        /// </summary>
        public PhysicsFactory(
            IElementFactory elementFactory,
            IForceFactory forceFactory)
        {
            ArgumentChecks.AssertNotNull(elementFactory, nameof(elementFactory));
            ArgumentChecks.AssertNotNull(forceFactory, nameof(forceFactory));

            this._elementFactory = elementFactory;
            this._forceFactory   = forceFactory;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhysicalWorld"/> class.
        /// </summary>
        public PhysicalWorld(
            IElementFactory elementFactory,
            IForceFactory forceFactory)
        {
            ArgumentChecks.AssertNotNull(elementFactory, nameof(elementFactory));
            ArgumentChecks.AssertNotNull(forceFactory, nameof(forceFactory));

            this._elementFactory = elementFactory;
            this._forceFactory   = forceFactory;

            this._physicalSpace = this._elementFactory.CreateSpace();

            ////// Configure world, add gravity (this might get a little more flexible in the future).
            ////var gravity = this._forceFactory.CreateGravity(PhysicsConstants.EarthGravityAcceleration);
            ////this._physicalSpace.AddForceForParticles(gravity.ForParticles);
            ////this._physicalSpace.AddForceForBodies(gravity.ForBodies);
        }