Пример #1
0
 public void Dispose() {
     if (Texture != null) {
         //TextureExtensions.Unhook(Texture);
         #if UNITY
         GameObject.Destroy(Texture);
         #else
         Texture.Dispose();
         #endif
     }
     Texture = null;
     Timing = null;
 }
Пример #2
0
 public void UpdateAction()
 {
   if (this.Emitter != null)
   {
     if (this.Emitter.Cue != null && this.Emitter.Cue.IsLooped)
       this.Emitter.Cue.Stop(true);
     this.Emitter = (SoundEmitter) null;
   }
   AnimatedTexture animation = this.Npc.Actions[this.CurrentAction].Animation;
   SoundEffect sound = this.Npc.Actions[this.CurrentAction].Sound;
   if (this.CurrentAction == NpcAction.Talk && this.CurrentLine != null && this.CurrentLine.OverrideContent != null)
   {
     if (this.CurrentLine.OverrideContent.Animation != null)
       animation = this.CurrentLine.OverrideContent.Animation;
     if (this.CurrentLine.OverrideContent.Sound != null)
       sound = this.CurrentLine.OverrideContent.Sound;
   }
   this.CurrentTiming = animation.Timing.Clone();
   this.CurrentAnimation = animation;
   this.Group.Texture = (Texture) animation.Texture;
   this.UpdateScale();
   if (sound == null || this.Npc.ActorType == ActorType.Owl && this.OwlInvisible || !this.initialized)
     return;
   if (this.CurrentAction == NpcAction.Talk)
   {
     if (this.talkEmitter == null || this.talkEmitter.Dead)
     {
       this.talkEmitter = SoundEffectExtensions.EmitAt(sound, this.Position, true, RandomHelper.Centered(0.05));
     }
     else
     {
       this.talkEmitter.Position = this.Position;
       Waiters.Wait(0.100000001490116, (Action) (() =>
       {
         this.talkEmitter.Cue.Resume();
         this.talkEmitter.VolumeFactor = 1f;
       })).AutoPause = true;
     }
   }
   else
     this.Emitter = SoundEffectExtensions.EmitAt(sound, this.Position, true, RandomHelper.Centered(0.05));
 }
Пример #3
0
 protected override void LoadContent()
 {
   this.LiquidMesh = new Mesh()
   {
     AlwaysOnTop = true,
     DepthWrites = false,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     Culling = CullMode.None,
     Effect = (BaseEffect) new DefaultEffect.VertexColored()
   };
   Group group1 = this.LiquidMesh.AddColoredBox(Vector3.One, Vector3.Zero, Color.White, true);
   group1.Position = new Vector3(0.0f, -0.5f, 0.0f);
   group1.BakeTransform<FezVertexPositionColor>();
   group1.Position = new Vector3(0.0f, -1f, 0.0f);
   group1.Scale = new Vector3(100f);
   group1.Material = new Material();
   Group group2 = this.LiquidMesh.AddColoredBox(Vector3.One, Vector3.Zero, Color.White, true);
   group2.Position = new Vector3(0.0f, -0.5f, 0.0f);
   group2.BakeTransform<FezVertexPositionColor>();
   group2.Position = new Vector3(0.0f, -1f, 0.0f);
   group2.Scale = new Vector3(100f);
   group2.Material = new Material();
   this.RaysMesh = new Mesh()
   {
     AlwaysOnTop = true,
     DepthWrites = false,
     Blending = new BlendingMode?(BlendingMode.Additive),
     Culling = CullMode.CullClockwiseFace,
     Effect = (BaseEffect) new DefaultEffect.VertexColored()
   };
   this.CausticsAnimation = this.CMProvider.Global.Load<AnimatedTexture>("Other Textures/FINAL_caustics");
   this.CausticsAnimation.Timing.Loop = true;
   this.BackgroundCausticsTiming = this.CausticsAnimation.Timing.Clone();
   this.BackgroundCausticsTiming.RandomizeStep();
   this.CausticsMesh = new Mesh()
   {
     AlwaysOnTop = true,
     DepthWrites = false,
     SamplerState = SamplerState.PointWrap,
     Effect = (BaseEffect) new CausticsEffect()
   };
   Group group3 = this.CausticsMesh.AddTexturedCylinder(Vector3.One, Vector3.Zero, 3, 4, false, false);
   group3.Material = new Material();
   group3.Texture = (Texture) this.CausticsAnimation.Texture;
   this.SmallBubbleAnim = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/lava/lava_a");
   this.MediumBubbleAnim = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/lava/lava_b");
   this.LargeBubbleAnim = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/lava/lava_c");
   this.SmokeAnim = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/lava/lava_smoke");
 }