Example #1
0
        /// <summary>
        /// Applies velocity to the <see cref="PseudoBody"/>.
        /// </summary>
        public virtual void ApplyVelocity()
        {
            if (!isActiveAndEnabled || Interactors.NonSubscribableElements.Count > 0 || VelocityProxy.ProxySource == null)
            {
                return;
            }

            VelocityEmitter.EmitVelocity();
            Facade.Target.ApplyVelocity(VelocityMultiplier.Result);
            VelocityProxy.ProxySource = null;
        }
Example #2
0
        /// <summary>
        /// Applies velocity to the <see cref="BodyRepresentation"/>.
        /// </summary>
        public virtual void ApplyVelocity()
        {
            if (!isActiveAndEnabled || interactors.Elements.Any() || velocityProxy.proxySource == null)
            {
                return;
            }

            velocityEmitter.EmitVelocity();
            facade.bodyRepresentationFacade.ListenToRigidbodyMovement();
            facade.bodyRepresentationFacade.internalSetup.rigidbody.velocity += velocityMultiplier.Result;
            velocityProxy.ClearProxySource();
        }
        /// <summary>
        /// Applies velocity to the <see cref="PseudoBody"/>.
        /// </summary>
        public virtual void ApplyVelocity()
        {
            if (!isActiveAndEnabled || Interactors.NonSubscribableElements.Count > 0 || VelocityProxy.ProxySource == null)
            {
                return;
            }

            VelocityEmitter.EmitVelocity();
            Facade.PseudoBodyFacade.ListenToRigidbodyMovement();
            Facade.PseudoBodyFacade.PhysicsBody.velocity -= VelocityMultiplier.Result;
            VelocityProxy.ProxySource = null;
        }