public void Initialize() { if (ServiceHelper.IsFull) { this.CMProvider = ServiceHelper.Get <IContentManagerProvider>(); this.LevelManager = ServiceHelper.Get <ILevelManager>(); this.LevelMaterializer = ServiceHelper.Get <ILevelMaterializer>(); } if (this.Animated) { if (this.animation == null) { this.animation = this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/" + this.TextureName); this.Timing = this.animation.Timing.Clone(); this.Texture = (Texture)this.animation.Texture; this.actualWidth = this.animation.FrameWidth; this.actualHeight = this.animation.FrameHeight; } this.Timing.Loop = true; this.Timing.RandomizeStep(); this.Size = new Vector3((float)this.actualWidth / 16f, (float)this.actualHeight / 16f, 0.125f); } else { if (this.Texture == null) { this.Texture = (Texture)this.CMProvider.CurrentLevel.Load <Texture2D>("Background Planes/" + this.TextureName); } this.Size = new Vector3((float)(this.Texture as Texture2D).Width / 16f, (float)(this.Texture as Texture2D).Height / 16f, 0.125f); } this.InitializeGroup(); }
public BackgroundPlane(Mesh hostMesh, AnimatedTexture animation) : this() { this.HostMesh = hostMesh; this.Timing = animation.Timing.Clone(); this.Texture = (Texture)animation.Texture; this.Animated = true; this.animation = animation; this.actualWidth = animation.FrameWidth; this.actualHeight = animation.FrameHeight; this.Initialize(); }
private void TryInitialize() { this.OpenSplash = this.OpeningSplash = this.OpenWaterfall = this.OpeningWaterfall = (AnimatedTexture) null; this.sWaterfallOpening = (SoundEffect) null; this.eWaterfallClosed = (SoundEmitter) null; this.eWaterfallOpen = (SoundEmitter) null; this.WaterfallPlane = Enumerable.FirstOrDefault<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => x.ActorType == ActorType.BigWaterfall)); this.Enabled = this.WaterfallPlane != null; if (!this.Enabled) return; this.MoriaPlane = Enumerable.FirstOrDefault<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => x.TextureName == "MORIA_GLOW")); if (this.GameState.SaveData.ThisLevel.InactiveGroups.Contains(1) || this.GameState.SaveData.ThisLevel.InactiveVolumes.Contains(19)) this.MoriaPlane.Opacity = 0.0f; this.MoriaPlane.Position -= Vector3.UnitX * (1.0 / 1000.0); Comparison<Group> oldGo = this.LevelMaterializer.StaticPlanesMesh.GroupOrder; this.LevelMaterializer.StaticPlanesMesh.GroupOrder = (Comparison<Group>) ((x, y) => { if (x == this.MoriaPlane.Group) return 1; if (y != this.MoriaPlane.Group) return oldGo(x, y); else return -1; }); bool flag = this.GameState.SaveData.ThisLevel.ScriptingState == "WATERFALL_OPEN"; if (flag) { this.OpenSplash = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash_open"); this.OpenWaterfall = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_open"); Waiters.Wait((Func<bool>) (() => !this.GameState.Loading), (Action) (() => this.LevelManager.Volumes[7].Enabled = true)); } else this.ForkLoad(false); this.SplashPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, flag ? this.OpenSplash : this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash")) { Doublesided = true }; this.LevelManager.AddPlane(this.SplashPlane); this.Top = FezMath.Dot(this.WaterfallPlane.Position + this.WaterfallPlane.Scale * this.WaterfallPlane.Size / 2f, Vector3.UnitY); this.TerminalPosition = this.WaterfallPlane.Position - this.WaterfallPlane.Scale * this.WaterfallPlane.Size / 2f * Vector3.UnitY + Vector3.Transform(Vector3.UnitZ, this.WaterfallPlane.Rotation) / 16f; this.sinceAlive = 0.0f; if (flag) { this.SwapOpened(); this.eWaterfallOpen = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/BigWaterfallOpen"), this.WaterfallPlane.Position, true, 0.0f, 0.0f); } else this.eWaterfallClosed = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/BigWaterfallClosed"), this.WaterfallPlane.Position, true, 0.0f, 0.0f); }
public override void Update(GameTime gameTime) { if (this.PlayerManager.Animation == null) return; this.playerMesh.Position = this.PlayerManager.Position + (float) ((1.0 - ((double) this.PlayerManager.Size.Y + (this.PlayerManager.CarriedInstance != null || this.PlayerManager.Action == ActionType.ThrowingHeavy ? -2.0 : 0.0))) / 2.0) * Vector3.UnitY; if (this.lastAnimation != this.PlayerManager.Animation) { this.effect.Animation = (Texture) this.PlayerManager.Animation.Texture; this.lastAnimation = this.PlayerManager.Animation; } int width = this.lastAnimation.Texture.Width; int height = this.lastAnimation.Texture.Height; Rectangle rectangle = this.lastAnimation.Offsets[this.lastAnimation.Timing.Frame]; this.playerMesh.FirstGroup.TextureMatrix.Set(new Matrix?(new Matrix((float) rectangle.Width / (float) width, 0.0f, 0.0f, 0.0f, 0.0f, (float) rectangle.Height / (float) height, 0.0f, 0.0f, (float) rectangle.X / (float) width, (float) rectangle.Y / (float) height, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f))); if (this.lastBackground != this.PlayerManager.Background && !ActionTypeExtensions.NoBackgroundDarkening(this.PlayerManager.Action)) { this.sinceBackgroundChanged = TimeSpan.Zero; this.lastBackground = this.PlayerManager.Background; if (!this.LevelManager.LowPass && EndCutscene32Host.Instance == null && EndCutscene64Host.Instance == null) this.SoundManager.FadeFrequencies(this.PlayerManager.Background); } if (this.sinceBackgroundChanged.TotalSeconds < 1.0) this.sinceBackgroundChanged += gameTime.ElapsedGameTime; this.effect.Background = ActionTypeExtensions.NoBackgroundDarkening(this.PlayerManager.Action) ? 0.0f : FezMath.Saturate(this.PlayerManager.Background ? (float) (this.sinceBackgroundChanged.TotalSeconds * 2.0) : (float) (1.0 - this.sinceBackgroundChanged.TotalSeconds * 2.0)); bool flag1 = (double) this.CollisionManager.GravityFactor < 0.0; Viewpoint view = FezMath.IsOrthographic(this.CameraManager.Viewpoint) || !this.CameraManager.ActionRunning ? this.CameraManager.Viewpoint : this.CameraManager.LastViewpoint; Vector2 vector2 = ActionTypeExtensions.GetOffset(this.PlayerManager.Action) / 16f; vector2.Y -= this.lastAnimation.PotOffset.Y / 64f; this.playerMesh.Scale = new Vector3((float) this.PlayerManager.Animation.FrameWidth / 16f, (float) this.PlayerManager.Animation.FrameHeight / 16f * (float) Math.Sign(this.CollisionManager.GravityFactor), 1f); this.playerMesh.Position += vector2.X * FezMath.RightVector(view) * (float) FezMath.Sign(this.PlayerManager.LookingDirection) + (flag1 ? (float) (-(double) vector2.Y - 1.0 / 16.0) : vector2.Y) * Vector3.UnitY; bool flag2 = this.PlayerManager.HideFez && !this.GameState.SaveData.IsNewGamePlus && !this.PlayerManager.Animation.NoHat && !ActionTypeExtensions.IsCarry(this.PlayerManager.Action); if (this.lastHideFez == flag2) return; this.lastHideFez = flag2; this.effect.NoMoreFez = this.lastHideFez; }
public override void Update(GameTime gameTime) { if (NetworkGomezClient.Instance != null) { NetworkGomezClient.Instance.Action = NetworkGomezClient.Instance.Action ?? UpdateNetGomez; } NetworkGomezData networkData = this.networkData; if (networkData != null) { Position = networkData.Position; Rotation = networkData.Rotation; Opacity = networkData.Opacity; Background = networkData.Background; Action = networkData.Action; TextureMatrix = networkData.TextureMatrix; //EffectBackground = networkData.EffectBackground; Scale = networkData.Scale; NoMoreFez = networkData.NoMoreFez; ForceSilhouette = false; DrawStars = false; if (networkData.InCutscene || networkData.InMap || networkData.InMenuCube || networkData.Paused) { DrawStars = true; } if (networkData.Viewpoint != CameraManager.Viewpoint) { Rotation = CameraManager.Rotation; Opacity = 0.75f; } if (networkData.Level != LevelManager.Name) { DrawStars = true; } } playerMesh.FirstGroup.TextureMatrix.Set(TextureMatrix); effect.Background = EffectBackground; playerMesh.Scale = Scale; effect.NoMoreFez = NoMoreFez; if (Action != PrevAction) { Animation = PlayerManager.GetAnimation(Action); } PrevAction = Action; if (Animation == null) { return; } effect.Animation = Animation.Texture; }
protected override void LoadContent() { this.stars.Effect = (BaseEffect) new StarsEffect(); this.shootingStar = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/shootingstar"); this.sShootingStar = this.CMProvider.Global.Load<SoundEffect>("Sounds/Nature/ShootingStar"); this.LevelManager.SkyChanged += new Action(this.InitializeSky); }
private void SpawnDust(TrileInstance instance, float opacity, AnimatedTexture animation, bool onRight, bool onLeft) { float num1 = (float) ((double) instance.Center.Y - (double) instance.TransformedSize.Y / 2.0 * (double) Math.Sign(this.CollisionManager.GravityFactor) + (double) animation.FrameHeight / 32.0 * (double) Math.Sign(this.CollisionManager.GravityFactor)); float num2 = (float) ((double) FezMath.Dot(instance.TransformedSize, FezMath.SideMask(this.CameraManager.Viewpoint)) / 2.0 + (double) animation.FrameWidth / 32.0 * 2.0 / 3.0); if (ActorTypeExtensions.IsBomb(instance.Trile.ActorSettings.Type)) num2 -= 0.25f; opacity = 1f; Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint); Vector3 vector3_2 = FezMath.ForwardVector(this.CameraManager.Viewpoint); bool b = (double) this.CollisionManager.GravityFactor < 0.0; if (onRight) { BackgroundPlane backgroundPlane; this.LevelManager.AddPlane(backgroundPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation) { OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float) FezMath.AsNumeric(b) * 3.141593f), Doublesided = true, Loop = false, Opacity = opacity, Timing = { Step = 0.0f } }); backgroundPlane.Position = instance.Center * FezMath.XZMask + vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2; backgroundPlane.Billboard = true; } if (!onLeft) return; BackgroundPlane backgroundPlane1; this.LevelManager.AddPlane(backgroundPlane1 = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation) { OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 3.141593f) * Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float) FezMath.AsNumeric(b) * 3.141593f), Doublesided = true, Loop = false, Opacity = opacity, Timing = { Step = 0.0f } }); backgroundPlane1.Position = instance.Center * FezMath.XZMask - vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2; backgroundPlane1.Billboard = true; }
protected override void LoadContent() { this.largeDust = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/dust_large"); this.smallDust = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/dust_small"); this.vaseBreakSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/VaseBreak"); this.thudSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/HitFloor"); }
protected override void LoadContent() { this.explodeSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/BombExplode"); this.crystalsplodeSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/TntExplode"); this.countdownSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/BombCountdown"); this.bombAnimation = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/BombExplosion"); this.bigBombAnimation = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/BigBombExplosion"); this.tntAnimation = this.CMProvider.Global.Load<AnimatedTexture>("Background Planes/TntExplosion"); this.flare = this.CMProvider.Global.Load<Texture2D>("Background Planes/Flare"); this.flashesMesh = new Mesh() { AlwaysOnTop = true, Blending = new BlendingMode?(BlendingMode.Alphablending), Effect = (BaseEffect) new DefaultEffect.VertexColored() }; }
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)); }
private void ForkLoad(bool dummy) { this.OpenSplash = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash_open"); this.OpenWaterfall = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_open"); this.OpeningSplash = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash_opening"); this.OpeningWaterfall = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_opening"); this.sWaterfallOpening = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/BigWaterfallOpening"); }
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"); }
public void Initialize() { if (ServiceHelper.IsFull) { this.CMProvider = ServiceHelper.Get<IContentManagerProvider>(); this.LevelManager = ServiceHelper.Get<ILevelManager>(); this.LevelMaterializer = ServiceHelper.Get<ILevelMaterializer>(); } if (this.Animated) { if (this.animation == null) { this.animation = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/" + this.TextureName); this.Timing = this.animation.Timing.Clone(); this.Texture = (Texture) this.animation.Texture; this.actualWidth = this.animation.FrameWidth; this.actualHeight = this.animation.FrameHeight; } this.Timing.Loop = true; this.Timing.RandomizeStep(); this.Size = new Vector3((float) this.actualWidth / 16f, (float) this.actualHeight / 16f, 0.125f); } else { if (this.Texture == null) this.Texture = (Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Background Planes/" + this.TextureName); this.Size = new Vector3((float) (this.Texture as Texture2D).Width / 16f, (float) (this.Texture as Texture2D).Height / 16f, 0.125f); } this.InitializeGroup(); }
public BackgroundPlane(Mesh hostMesh, AnimatedTexture animation) : this() { this.HostMesh = hostMesh; this.Timing = animation.Timing.Clone(); this.Texture = (Texture) animation.Texture; this.Animated = true; this.animation = animation; this.actualWidth = animation.FrameWidth; this.actualHeight = animation.FrameHeight; this.Initialize(); }