Example #1
0
        public ObjectMovementSpeedSystem(CoreInteractiveObject associatedInteractiveObject, TransformMoveManagerComponentV3 aiTransformMoveManagerComponentV3,
                                         IObjectSpeedAttenuationValueSystem ObjectSpeedAttenuationValueSystem, ObjectSpeedCalculationType InitialObjectSpeedCalculationType)
        {
            AssociatedInteractiveObject            = associatedInteractiveObject;
            AITransformMoveManagerComponentV3      = aiTransformMoveManagerComponentV3;
            this.ObjectSpeedCalculationType        = InitialObjectSpeedCalculationType;
            this.ObjectSpeedAttenuationValueSystem = ObjectSpeedAttenuationValueSystem;

            this.ObjectMovementSpeedSystemState = new ObjectMovementSpeedSystemState()
            {
                LastFrameWorldPosition = this.AssociatedInteractiveObject.InteractiveGameObject.InteractiveGameObjectParent.transform.position,
            };
        }
Example #2
0
        public static float CalculateDesiredSpeed_Unscaled_Attenuated(ObjectSpeedCalculationType ObjectSpeedCalculationType,
                                                                      CoreInteractiveObject CoreInteractiveObject,
                                                                      AIMovementSpeedAttenuationFactor SpeedAttenuationFactor)
        {
            var SpeedMagnitude = 0f;

            if (ObjectSpeedCalculationType == ObjectSpeedCalculationType.AGENT)
            {
                var agent = CoreInteractiveObject.InteractiveGameObject.Agent;
                if (agent != null && agent.hasPath)
                {
                    SpeedMagnitude = AIMovementSpeedAttenuationFactors.AIMovementSpeedAttenuationFactorLookup[SpeedAttenuationFactor];
                }
            }

            return(SpeedMagnitude);
        }
Example #3
0
        public static float CalculateEffectiveSpeed_Unscaled_Attenuated(ObjectSpeedCalculationType ObjectSpeedCalculationType,
                                                                        CoreInteractiveObject CoreInteractiveObject,
                                                                        Vector3 LastFramePosition,
                                                                        TransformMoveManagerComponentV3 TransformMoveManagerComponentV3,
                                                                        float d)
        {
            var SpeedMagnitude = 0f;

            if (ObjectSpeedCalculationType == ObjectSpeedCalculationType.AGENT)
            {
                var agent = CoreInteractiveObject.InteractiveGameObject.Agent;
                if (agent != null && agent.hasPath)
                {
                    SpeedMagnitude  = Vector3.Distance(agent.transform.position, LastFramePosition) / d;
                    SpeedMagnitude /= TransformMoveManagerComponentV3.SpeedMultiplicationFactor;
                }
            }

            return(SpeedMagnitude);
        }
Example #4
0
 public void SetObjectSpeedCalculationType(ObjectSpeedCalculationType ObjectSpeedCalculationType)
 {
     this.ObjectSpeedCalculationType = ObjectSpeedCalculationType;
 }