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

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

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

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

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

            // Activation by velocity\offset coroutines
            if (simulationType == SimType.Inactive || simulationType == SimType.Kinematic)
            {
                // TODO skip not activatable uny objects
                // if (activation.unyielding == true && activation.activatable == fading)

                if (activation.byVelocity > 0)
                {
                    StartCoroutine(activation.ActivationVelocityCor(this));
                }
                if (activation.byOffset > 0)
                {
                    //RayfireMan.inst.AddActivationOffset (this);
                    StartCoroutine(activation.ActivationOffsetCor(this));
                }
            }

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

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

            // Init restriction check
            RayfireRestriction.InitRestriction(this);
        }
Beispiel #2
0
        // Copy from
        public void CopyFrom(RayfireRestriction 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();
        }