public void RepairTick(float repairFraction)
        {
            if (OWMath.ApproxEquals(AttachedObject._repairFraction, repairFraction))
            {
                return;
            }

            AttachedObject._repairFraction = repairFraction;
            var damageEffect = AttachedObject._damageEffect;

            damageEffect.SetEffectBlend(1f - repairFraction);
        }
        public void RepairTick(float repairFraction)
        {
            if (OWMath.ApproxEquals(AttachedObject._repairFraction, repairFraction))
            {
                return;
            }

            DebugLog.DebugWrite($"[SATELLITE NODE] {AttachedObject} repair tick {repairFraction}");
            AttachedObject._repairFraction = repairFraction;
            var damageEffect = AttachedObject._damageEffect;

            damageEffect.SetEffectBlend(1f - repairFraction);
        }
        public void ChangeIntegrity(float newIntegrity)
        {
            if (OWMath.ApproxEquals(AttachedObject._integrity, newIntegrity))
            {
                return;
            }

            DebugLog.DebugWrite($"[HULL] {AttachedObject} Change integrity to {newIntegrity}.");
            AttachedObject._integrity = newIntegrity;
            var damageEffect = AttachedObject._damageEffect;

            damageEffect.SetEffectBlend(1f - newIntegrity);
        }
 private void UpdatePools(float target, float length)
 {
     _poolT = Mathf.MoveTowards(_poolT, target, Time.deltaTime / length);
     if (OWMath.ApproxEquals(_poolT, target))
     {
         if (_slavePlatform != null && target == 0f)
         {
             _slavePlatform = null;
         }
         return;
     }
     UpdatePoolRenderer();
     _slavePlatform._poolT = _poolT;
     _slavePlatform.UpdatePoolRenderer();
 }
示例#5
0
        private void Update()
        {
            var target = _visible ? 1f : 0f;

            _visibleFraction = Mathf.MoveTowards(_visibleFraction, target, _fadeRate * Time.deltaTime);
            if (OWMath.ApproxEquals(_visibleFraction, target))
            {
                _visibleFraction = target;
                enabled          = false;
                if (_visible)
                {
                    UpdateShadowCasting();
                }
            }

            UpdateDithering();
        }
        public override void OnReceiveRemote()
        {
            WorldObject.AttachedObject._origIntegrity = OrigIntegrity;
            WorldObject.LeashLength = LeashLength;
            if (!OWMath.ApproxEquals(WorldObject.AttachedObject._integrity, Integrity))
            {
                WorldObject.AttachedObject._integrity = Integrity;
                WorldObject.AttachedObject.CallOnTakeDamage();
            }

            if (IsDetached && !WorldObject.IsDetached)
            {
                // the detach is delayed, so wait until that happens
                Delay.RunWhen(() => WorldObject.IsDetached, () =>
                {
                    var body = WorldObject.Body;

                    if (IsThruWhiteHole && !WorldObject.IsThruWhiteHole)
                    {
                        var whiteHoleVolume       = MeteorManager.WhiteHoleVolume;
                        var attachedFluidDetector = body.GetAttachedFluidDetector();
                        var attachedForceDetector = body.GetAttachedForceDetector();
                        if (attachedFluidDetector is ConstantFluidDetector constantFluidDetector)
                        {
                            constantFluidDetector.SetDetectableFluid(whiteHoleVolume._fluidVolume);
                        }

                        if (attachedForceDetector is ConstantForceDetector constantForceDetector)
                        {
                            constantForceDetector.ClearAllFields();
                        }

                        WorldObject.DetachableFragment.ChangeFragmentSector(whiteHoleVolume._whiteHoleSector,
                                                                            whiteHoleVolume._whiteHoleProxyShadowSuperGroup);

                        WorldObject.DetachableFragment.EndWarpScaling();
                        body.gameObject.AddComponent <DebrisLeash>().Init(whiteHoleVolume._whiteHoleBody, WorldObject.LeashLength);
                        whiteHoleVolume._ejectedBodyList.Add(body);
                    }
                    else if (!IsThruWhiteHole && WorldObject.IsThruWhiteHole)
                    {
                        // should only happen if client is way too far ahead and they try to connect. we fail here.
                        DebugLog.ToConsole($"{WorldObject} is thru white hole, but msg is not. f**k", MessageType.Error);
                        return;
                    }

                    if (WorldObject.IsThruWhiteHole)
                    {
                        var debrisLeash            = body.GetComponent <DebrisLeash>();
                        debrisLeash._deccelerating = false;
                        debrisLeash.enabled        = true;
                    }

                    var refBody = WorldObject.RefBody;
                    var pos     = refBody.transform.FromRelPos(RelPos);
                    body.SetPosition(pos);
                    body.SetRotation(refBody.transform.FromRelRot(RelRot));
                    body.SetVelocity(refBody.FromRelVel(RelVel, pos));
                    body.SetAngularVelocity(refBody.FromRelAngVel(RelAngVel));
                });
            }
            else if (!IsDetached && WorldObject.IsDetached)
            {
                // should only happen if client is way too far ahead and they try to connect. we fail here.
                DebugLog.ToConsole($"{WorldObject} is detached, but msg is not. f**k", MessageType.Error);
            }
        }