Beispiel #1
0
        /// /////////////////////////////////////////////////////////
        /// Coroutines
        /// /////////////////////////////////////////////////////////

        // Start all coroutines
        public void StartAllCoroutines()
        {
            // Stop if static
            if (simulationType == SimType.Static)
            {
                return;
            }

            // Prevent physics cors
            if (physics.exclude == true)
            {
                return;
            }

            // Inactive
            if (gameObject.activeSelf == false)
            {
                return;
            }

            // Check for demolition state every frame
            if (demolitionType != DemolitionType.None)
            {
                StartCoroutine(limitations.DemolishableCor(this));
            }

            // Cache physics data for fragments
            StartCoroutine(physics.PhysicsDataCor(this));

            // Activation by velocity\offset coroutines
            if (simulationType == SimType.Inactive || simulationType == SimType.Kinematic)
            {
                if (activation.byVelocity > 0)
                {
                    StartCoroutine(activation.ActivationVelocityCor(this));
                }
                if (activation.byOffset > 0)
                {
                    StartCoroutine(activation.ActivationOffsetCor(this));
                }
            }

            // Init inactive every frame update coroutine
            if (simulationType == SimType.Inactive)
            {
                StartCoroutine(activation.InactiveCor(this));
            }

            // Init restriction check
            RFRestriction.InitRestriction(this);
        }
Beispiel #2
0
        // Copy from
        public void CopyFrom(RFRestriction rest)
        {
            enable        = rest.enable;
            checkInterval = rest.checkInterval;
            breakAction   = rest.breakAction;

            distance = rest.distance;
            position = rest.position;
            target   = rest.target;

            collider = rest.collider;
            region   = rest.region;

            Reset();
        }