예제 #1
0
        private void AddDownforce(TrileInstance instance, float factor, bool apply, bool propagate)
        {
            if (instance == null || instance.TrileId != 286)
            {
                return;
            }
            BridgeState bridgeState;

            if (!this.ActiveBridgeParts.TryGetValue(instance, out bridgeState))
            {
                this.ActiveBridgeParts.Add(instance, bridgeState = new BridgeState(instance));
            }
            else if (apply && bridgeState.Dirty)
            {
                return;
            }
            Vector3 vector3 = FezMath.SideMask(this.CameraManager.Viewpoint);

            if (apply)
            {
                bridgeState.Downforce = MathHelper.Clamp(bridgeState.Downforce + factor, 0.0f, 1f);
                bridgeState.Dirty     = true;
            }
            if (!propagate)
            {
                return;
            }
            TrileEmplacement id = new TrileEmplacement(bridgeState.OriginalPosition - vector3);

            this.AddDownforce(this.LevelManager.TrileInstanceAt(ref id), factor / 2f, true, true);
            id = new TrileEmplacement(bridgeState.OriginalPosition + vector3);
            this.AddDownforce(this.LevelManager.TrileInstanceAt(ref id), factor / 2f, true, true);
        }
예제 #2
0
 private void AddDownforce(TrileInstance instance, float factor, bool apply, bool propagate)
 {
   if (instance == null || instance.TrileId != 286)
     return;
   BridgeState bridgeState;
   if (!this.ActiveBridgeParts.TryGetValue(instance, out bridgeState))
     this.ActiveBridgeParts.Add(instance, bridgeState = new BridgeState(instance));
   else if (apply && bridgeState.Dirty)
     return;
   Vector3 vector3 = FezMath.SideMask(this.CameraManager.Viewpoint);
   if (apply)
   {
     bridgeState.Downforce = MathHelper.Clamp(bridgeState.Downforce + factor, 0.0f, 1f);
     bridgeState.Dirty = true;
   }
   if (!propagate)
     return;
   TrileEmplacement id = new TrileEmplacement(bridgeState.OriginalPosition - vector3);
   this.AddDownforce(this.LevelManager.TrileInstanceAt(ref id), factor / 2f, true, true);
   id = new TrileEmplacement(bridgeState.OriginalPosition + vector3);
   this.AddDownforce(this.LevelManager.TrileInstanceAt(ref id), factor / 2f, true, true);
 }