Пример #1
0
 public void Initialize(PlaneParticleSystem system)
 {
     this.System        = system;
     this.Settings      = system.Settings;
     this.LifeColor     = this.Settings.ColorLife.Evaluate().ToVector4();
     this.SpawnColor    = this.Settings.ColorBirth == null ? new Vector4(FezMath.XYZ(this.LifeColor), 0.0f) : this.Settings.ColorBirth.Evaluate().ToVector4();
     this.DieColor      = this.Settings.ColorDeath == null ? new Vector4(FezMath.XYZ(this.LifeColor), 0.0f) : this.Settings.ColorDeath.Evaluate().ToVector4();
     this.Scale         = this.SizeBirth = this.Settings.SizeBirth.Evaluate();
     this.SizeDeath     = this.Settings.SizeDeath.Base == new Vector3(-1f) ? this.SizeBirth : this.Settings.SizeDeath.Evaluate();
     this.Position      = new Vector3(RandomHelper.Between((double)this.Settings.SpawnVolume.Min.X, (double)this.Settings.SpawnVolume.Max.X), RandomHelper.Between((double)this.Settings.SpawnVolume.Min.Y, (double)this.Settings.SpawnVolume.Max.Y), RandomHelper.Between((double)this.Settings.SpawnVolume.Min.Z, (double)this.Settings.SpawnVolume.Max.Z));
     this.Velocity      = !this.Settings.EnergySource.HasValue ? this.Settings.Velocity.Evaluate() : Vector3.Normalize(this.Position - this.Settings.EnergySource.Value) * this.Settings.Velocity.Evaluate().Length();
     this.GravityEffect = Vector3.Zero;
     this.AgeSeconds    = 0.0f;
     this.DeathProvoked = false;
     this.Phi           = this.Settings.Orientation.HasValue ? FezMath.ToPhi(this.Settings.Orientation.Value) : FezMath.ToPhi(this.Camera.Viewpoint);
     this.System.Geometry.Instances[this.InstanceIndex] = new Matrix(this.Position.X, this.Position.Y, this.Position.Z, this.Phi, this.SizeBirth.X, this.SizeBirth.Y, this.SizeBirth.Z, 0.0f, this.SpawnColor.X, this.SpawnColor.Y, this.SpawnColor.Z, this.SpawnColor.W, 0.0f, 0.0f, 0.0f, 0.0f);
 }
Пример #2
0
 public RainTransition(Game game, PlaneParticleSystem rainPS)
   : base(game)
 {
   this.RainPS = rainPS;
 }
Пример #3
0
 public override void Update(GameTime gameTime)
 {
   if (this.GameState.Loading)
     return;
   if (this.Transition != null)
   {
     if (!this.GameState.FarawaySettings.InTransition)
     {
       this.RainPS = this.Transition.RainPS;
       this.PlaneSystems.Add(this.RainPS);
       this.RainPS.MoveActiveParticles(this.transitionCenter - this.CameraManager.Center);
       this.RainPS.SetViewProjectionSticky(false);
       ServiceHelper.RemoveComponent<RainHost.RainTransition>(this.Transition);
       this.Transition = (RainHost.RainTransition) null;
     }
     else
     {
       if (this.GameState.Paused || (double) this.GameState.FarawaySettings.DestinationCrossfadeStep <= 0.0)
         return;
       this.SpawnSplashes();
       return;
     }
   }
   Vector3 center = this.CameraManager.Center;
   int num = 60;
   Vector3 vector3 = new Vector3((float) num, (float) num / this.CameraManager.AspectRatio, (float) num) / 2f;
   this.RainPS.Settings.SpawnVolume = new BoundingBox()
   {
     Min = center - vector3 * FezMath.XZMask,
     Max = center + vector3 * new Vector3(1f, 2f, 1f)
   };
   if (this.GameState.Paused || !this.CameraManager.ActionRunning || (this.GameState.InMenuCube || this.GameState.InMap) || this.GameState.InFpsMode)
     return;
   this.SpawnSplashes();
 }
Пример #4
0
 private void TryInitialize()
 {
   this.RainPS = (PlaneParticleSystem) null;
   this.ePreThunder = (SoundEmitter) null;
   if (this.lightning != null)
     this.lightning.Dispose();
   this.lightning = (Mesh) null;
   this.trileTops = (TrileInstance[]) null;
   this.Visible = this.Enabled = this.LevelManager.Rainy;
   if (!this.Enabled)
     return;
   this.doThunder = this.LevelManager.Name != "INDUSTRIAL_CITY";
   if (this.Transition == null)
   {
     Vector3 vector3 = this.RainColor.ToVector3();
     PlaneParticleSystemSettings settings = new PlaneParticleSystemSettings();
     settings.Velocity = (VaryingVector3) new Vector3(0.0f, -50f, 0.0f);
     settings.SpawningSpeed = 60f;
     settings.ParticleLifetime = 0.6f;
     settings.SpawnBatchSize = 10;
     PlaneParticleSystemSettings particleSystemSettings1 = settings;
     VaryingVector3 varyingVector3_1 = new VaryingVector3();
     varyingVector3_1.Function = RainHost.RainScaling;
     VaryingVector3 varyingVector3_2 = varyingVector3_1;
     particleSystemSettings1.SizeBirth = varyingVector3_2;
     settings.FadeOutDuration = 0.1f;
     PlaneParticleSystemSettings particleSystemSettings2 = settings;
     VaryingColor varyingColor1 = new VaryingColor();
     varyingColor1.Base = this.RainColor;
     varyingColor1.Variation = new Color(0, 0, 0, 24);
     VaryingColor varyingColor2 = varyingColor1;
     particleSystemSettings2.ColorLife = varyingColor2;
     settings.ColorDeath = (VaryingColor) new Color(vector3.X, vector3.Y, vector3.Z, 0.0f);
     settings.ColorBirth = (VaryingColor) new Color(vector3.X, vector3.Y, vector3.Z, 0.0f);
     settings.Texture = this.CMProvider.Global.Load<Texture2D>("Other Textures/rain/rain");
     settings.BlendingMode = BlendingMode.Alphablending;
     settings.Billboarding = true;
     settings.NoLightDraw = true;
     this.PlaneSystems.Add(this.RainPS = new PlaneParticleSystem(this.Game, 500, settings));
     for (int index = 0; index < 75; ++index)
       this.PlaneSystems.RainSplash(Vector3.Zero).FadeOutAndDie(0.0f);
   }
   ContentManager contentManager = this.LevelManager.Name == null ? this.CMProvider.Global : this.CMProvider.CurrentLevel;
   this.lightning = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rain/lightning_a"))
   };
   this.lightning.AddFace(Vector3.One * new Vector3(16f, 32f, 16f), Vector3.Zero, FaceOrientation.Front, true, true);
   if (this.lightningSounds == null)
     this.lightningSounds = new SoundEffect[4]
     {
       contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder1"),
       contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder2"),
       contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder3"),
       contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder4")
     };
   if (this.thunderDistant == null)
     this.thunderDistant = new SoundEffect[3]
     {
       contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant01"),
       contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant02"),
       contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant03")
     };
   if (this.sPreThunder == null)
     this.sPreThunder = contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderRumble");
   this.trileTops = Enumerable.ToArray<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x =>
   {
     if (x.Enabled && !x.Trile.Immaterial && !ActorTypeExtensions.IsClimbable(x.Trile.ActorSettings.Type) && (x.Trile.Geometry == null || !x.Trile.Geometry.Empty || x.Trile.Faces[FaceOrientation.Front] != CollisionType.None))
       return this.NoTop(x);
     else
       return false;
   })));
   this.flashIn = TimeSpan.FromSeconds((double) RandomHelper.Between(4.0, 6.0));
   this.distantIn = TimeSpan.FromSeconds((double) RandomHelper.Between(3.0, 6.0));
 }
Пример #5
0
 public void Initialize(PlaneParticleSystem system)
 {
   this.System = system;
   this.Settings = system.Settings;
   this.LifeColor = this.Settings.ColorLife.Evaluate().ToVector4();
   this.SpawnColor = this.Settings.ColorBirth == null ? new Vector4(FezMath.XYZ(this.LifeColor), 0.0f) : this.Settings.ColorBirth.Evaluate().ToVector4();
   this.DieColor = this.Settings.ColorDeath == null ? new Vector4(FezMath.XYZ(this.LifeColor), 0.0f) : this.Settings.ColorDeath.Evaluate().ToVector4();
   this.Scale = this.SizeBirth = this.Settings.SizeBirth.Evaluate();
   this.SizeDeath = this.Settings.SizeDeath.Base == new Vector3(-1f) ? this.SizeBirth : this.Settings.SizeDeath.Evaluate();
   this.Position = new Vector3(RandomHelper.Between((double) this.Settings.SpawnVolume.Min.X, (double) this.Settings.SpawnVolume.Max.X), RandomHelper.Between((double) this.Settings.SpawnVolume.Min.Y, (double) this.Settings.SpawnVolume.Max.Y), RandomHelper.Between((double) this.Settings.SpawnVolume.Min.Z, (double) this.Settings.SpawnVolume.Max.Z));
   this.Velocity = !this.Settings.EnergySource.HasValue ? this.Settings.Velocity.Evaluate() : Vector3.Normalize(this.Position - this.Settings.EnergySource.Value) * this.Settings.Velocity.Evaluate().Length();
   this.GravityEffect = Vector3.Zero;
   this.AgeSeconds = 0.0f;
   this.DeathProvoked = false;
   this.Phi = this.Settings.Orientation.HasValue ? FezMath.ToPhi(this.Settings.Orientation.Value) : FezMath.ToPhi(this.Camera.Viewpoint);
   this.System.Geometry.Instances[this.InstanceIndex] = new Matrix(this.Position.X, this.Position.Y, this.Position.Z, this.Phi, this.SizeBirth.X, this.SizeBirth.Y, this.SizeBirth.Z, 0.0f, this.SpawnColor.X, this.SpawnColor.Y, this.SpawnColor.Z, this.SpawnColor.W, 0.0f, 0.0f, 0.0f, 0.0f);
 }
Пример #6
0
 public void Remove(PlaneParticleSystem system, bool returnToPool)
 {
   this.ActiveParticleSystems.Remove(system);
   if (!returnToPool)
     return;
   system.Clear();
   this.PooledParticleSystems.Return(system);
 }
Пример #7
0
 public void Add(PlaneParticleSystem system)
 {
   if (!system.Initialized)
     ServiceHelper.AddComponent((IGameComponent) system);
   system.Revive();
   this.ActiveParticleSystems.Add(system);
 }
Пример #8
0
 private void TryInitialize()
 {
   if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped))
     this.eIdleSpin.Cue.Stop(false);
   this.eIdleSpin = (SoundEmitter) null;
   this.rgbPlanes = (Mesh) null;
   this.particles = (PlaneParticleSystem) null;
   this.Phase = LesserWarp.Phases.None;
   this.sinceInitialized = 0.0f;
   this.GateAo = Enumerable.FirstOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.LesserGate));
   if (this.GateAo == null)
     return;
   this.InitializeRgbGate();
   LesserWarp lesserWarp = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.Fullbright = true;
   DefaultEffect.Textured textured2 = textured1;
   mesh2.Effect = (BaseEffect) textured2;
   mesh1.DepthWrites = false;
   mesh1.Texture = (Dirtyable<Texture>) ((Texture) this.WhiteTexture);
   mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f);
   Mesh mesh3 = mesh1;
   lesserWarp.MaskMesh = mesh3;
   this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true);
   this.MaskMesh.BakeTransformWithNormal<FezVertexPositionNormalTexture>();
   this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f;
   this.HasCubeShard = Enumerable.Any<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x =>
   {
     if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type))
       return (double) Vector3.Distance(x.Center, this.GateAo.Position) < 3.0;
     else
       return false;
   }));
   this.OriginalPosition = this.GateAo.Position;
   this.sRise = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpRise");
   this.sLower = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpLower");
   this.sActivate = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/WarpGateActivate");
   this.eIdleSpin = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true);
 }
Пример #9
0
 private void InitializeRgbGate()
 {
   IPlaneParticleSystems planeParticleSystems = this.PlaneParticleSystems;
   LesserWarp lesserWarp = this;
   Game game = this.Game;
   int maximumCount = 200;
   PlaneParticleSystemSettings particleSystemSettings = new PlaneParticleSystemSettings();
   particleSystemSettings.SpawnVolume = new BoundingBox()
   {
     Min = this.GateAo.Position + new Vector3(-2f, -3.5f, -2f),
     Max = this.GateAo.Position + new Vector3(2f, 2f, 2f)
   };
   particleSystemSettings.Velocity.Base = new Vector3(0.0f, 0.6f, 0.0f);
   particleSystemSettings.Velocity.Variation = new Vector3(0.0f, 0.1f, 0.1f);
   particleSystemSettings.SpawningSpeed = 5f;
   particleSystemSettings.ParticleLifetime = 6f;
   particleSystemSettings.Acceleration = 0.375f;
   particleSystemSettings.SizeBirth = (VaryingVector3) new Vector3(0.25f, 0.25f, 0.25f);
   particleSystemSettings.ColorBirth = (VaryingColor) Color.Black;
   particleSystemSettings.ColorLife = (VaryingColor) Color.Black;
   particleSystemSettings.ColorDeath = (VaryingColor) Color.Black;
   particleSystemSettings.FullBright = true;
   particleSystemSettings.RandomizeSpawnTime = true;
   particleSystemSettings.Billboarding = true;
   particleSystemSettings.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/dust_particle");
   particleSystemSettings.BlendingMode = BlendingMode.Additive;
   PlaneParticleSystemSettings settings = particleSystemSettings;
   PlaneParticleSystem planeParticleSystem1;
   PlaneParticleSystem planeParticleSystem2 = planeParticleSystem1 = new PlaneParticleSystem(game, maximumCount, settings);
   lesserWarp.particles = planeParticleSystem1;
   PlaneParticleSystem system = planeParticleSystem2;
   planeParticleSystems.Add(system);
   this.rgbPlanes = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     DepthWrites = false,
     AlwaysOnTop = true,
     SamplerState = SamplerState.LinearClamp,
     Blending = new BlendingMode?(BlendingMode.Additive),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/rgb_gradient"))
   };
   this.rgbPlanes.AddFace(new Vector3(1f, 4.5f, 1f), new Vector3(0.0f, 3f, 0.0f), FaceOrientation.Front, true).Material = new Material()
   {
     Diffuse = Vector3.Zero,
     Opacity = 0.0f
   };
   this.rgbPlanes.AddFace(new Vector3(1f, 4.5f, 1f), new Vector3(0.0f, 3f, 0.0f), FaceOrientation.Front, true).Material = new Material()
   {
     Diffuse = Vector3.Zero,
     Opacity = 0.0f
   };
   this.rgbPlanes.AddFace(new Vector3(1f, 4.5f, 1f), new Vector3(0.0f, 3f, 0.0f), FaceOrientation.Front, true).Material = new Material()
   {
     Diffuse = Vector3.Zero,
     Opacity = 0.0f
   };
   this.rgbPlanes.Position = this.GateAo.Position + new Vector3(0.0f, -2f, 0.0f);
 }
Пример #10
0
 public override void Initialize()
 {
   base.Initialize();
   ServiceHelper.AddComponent((IGameComponent) (this.Starfield = new StarField(this.Game)
   {
     Opacity = 0.0f,
     HasHorizontalTrails = true,
     FollowCamera = true
   }));
   ServiceHelper.AddComponent((IGameComponent) (this.SfRenderer = new EldersHexahedron.StarfieldRenderer(this.Game, this)));
   this.StatuePlanes = Enumerable.ToArray<BackgroundPlane>(Enumerable.Where<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => x.Id >= 0)));
   this.DealGlassesPlane = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     DepthWrites = false,
     AlwaysOnTop = false,
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures" + (this.GameState.SaveData.Finished64 ? "/deal_with_3d" : "/deal_with_it"))),
     SamplerState = SamplerState.PointClamp
   };
   this.DealGlassesPlane.AddFace(new Vector3(1f, 0.25f, 1f), Vector3.Zero, FaceOrientation.Right, true, true);
   ArtObject artObject = this.CMProvider.CurrentLevel.Load<ArtObject>("Art Objects/TINY_CHAPEAUAO");
   int key = IdentifierPool.FirstAvailable<ArtObjectInstance>(this.LevelManager.ArtObjects);
   this.TinyChapeau = new ArtObjectInstance(artObject)
   {
     Id = key
   };
   this.LevelManager.ArtObjects.Add(key, this.TinyChapeau);
   this.TinyChapeau.Initialize();
   this.TinyChapeau.Hidden = true;
   this.TinyChapeau.ArtObject.Group.Position = new Vector3(-0.125f, 0.375f, -0.125f);
   this.TinyChapeau.ArtObject.Group.BakeTransformInstanced<VertexPositionNormalTextureInstance, Matrix>();
   this.BeamMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     DepthWrites = false,
     AlwaysOnTop = false,
     Material = {
       Diffuse = new Vector3(221f, 178f, (float) byte.MaxValue) / (float) byte.MaxValue
     }
   };
   this.BeamMesh.AddFace(new Vector3(1f, 1f, 1f), Vector3.Zero, FaceOrientation.Right, true, true).Texture = (Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/VerticalGradient");
   Group group = this.BeamMesh.AddFace(new Vector3(2f, 1f, 2f), Vector3.Zero, FaceOrientation.Right, true, true);
   group.Texture = (Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/HorizontalGradient");
   group.Material = new Material()
   {
     Opacity = 0.4f,
     Diffuse = new Vector3(221f, 178f, (float) byte.MaxValue) / (float) byte.MaxValue
   };
   group.Enabled = false;
   this.BeamMask = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     DepthWrites = false,
     AlwaysOnTop = false
   };
   this.BeamMask.AddFace(new Vector3(1f, 1f, 1f), Vector3.Zero, FaceOrientation.Right, true, true);
   this.MatrixMesh = new Mesh()
   {
     Effect = (BaseEffect) new MatrixEffect(),
     DepthWrites = false,
     AlwaysOnTop = false,
     Blending = new BlendingMode?(BlendingMode.Multiply2X)
   };
   this.RaysMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     DepthWrites = false,
     AlwaysOnTop = false,
     Blending = new BlendingMode?(BlendingMode.Alphablending)
   };
   this.FlareMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     DepthWrites = false,
     AlwaysOnTop = false,
     SamplerState = SamplerState.LinearClamp,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/flare_alpha"))
   };
   this.FlareMesh.AddFace(new Vector3(1f, 1f, 1f), Vector3.Zero, FaceOrientation.Right, true, true);
   this.TrialRaysMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   if (this.GameState.IsTrialMode)
     this.TrialRaysMesh.Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray"));
   this.TrialFlareMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/flare_alpha")),
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   this.TrialFlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Right, true);
   this.LoadSounds();
   this.AoInstance.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 1.570796f) * Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
   this.Origin = this.AoInstance.Position;
   this.AoRotationOrigin = Quaternion.CreateFromAxisAngle(Vector3.Forward, 0.7853982f) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
   this.AoInstance.Material = new Material();
   this.PlayerManager.Position = new Vector3(18.5f, 879.0 / 32.0, 34.5f);
   this.PlayerManager.Position = this.PlayerManager.Position * Vector3.UnitY + FezMath.XZMask * this.AoInstance.Position;
   this.GomezOrigin = this.PlayerManager.Position;
   this.CameraManager.Center = new Vector3(18.5f, 879.0 / 32.0, 34.5f);
   this.CameraManager.Center = this.CameraManager.Center * Vector3.UnitY + FezMath.XZMask * this.AoInstance.Position + new Vector3(0.0f, 4f, 0.0f);
   this.CameraManager.SnapInterpolation();
   this.CameraOrigin = this.CameraManager.Center;
   while (!this.PlayerManager.CanControl)
     this.PlayerManager.CanControl = true;
   this.PlayerManager.CanControl = false;
   this.CameraManager.Constrained = true;
   this.PlayerManager.HideFez = true;
   this.GenerateCubes();
   for (int index = 1; index < 9; ++index)
     this.MatrixWords[index - 1] = this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/zuish_matrix/" + (object) index);
   this.SpinSpeed = 225f;
   SoundEffectExtensions.Emit(this.sHexSlowDown);
   this.eAmbientHex = SoundEffectExtensions.Emit(this.sAmbientHex, true, 0.0f, 0.5f);
   Vector3 vector3 = -FezMath.ForwardVector(this.CameraManager.Viewpoint) * 4f;
   IPlaneParticleSystems planeParticleSystems = this.PlaneParticleSystems;
   EldersHexahedron eldersHexahedron = this;
   Game game = this.Game;
   int maximumCount = 200;
   PlaneParticleSystemSettings particleSystemSettings = new PlaneParticleSystemSettings();
   particleSystemSettings.SpawnVolume = new BoundingBox()
   {
     Min = this.PlayerManager.Position + new Vector3(-1f, 5f, -1f) + vector3,
     Max = this.PlayerManager.Position + new Vector3(1f, 20f, 1f) + vector3
   };
   particleSystemSettings.Velocity.Base = new Vector3(0.0f, -0.5f, 0.0f);
   particleSystemSettings.Velocity.Variation = new Vector3(0.0f, -0.25f, 0.1f);
   particleSystemSettings.SpawningSpeed = 12f;
   particleSystemSettings.ParticleLifetime = 15f;
   particleSystemSettings.Acceleration = -0.1f;
   particleSystemSettings.SizeBirth = (VaryingVector3) new Vector3(0.125f, 0.125f, 0.125f);
   particleSystemSettings.ColorBirth = (VaryingColor) Color.Black;
   particleSystemSettings.ColorLife.Base = new Color(0.6f, 0.6f, 0.6f, 1f);
   particleSystemSettings.ColorLife.Variation = new Color(0.1f, 0.1f, 0.1f, 0.0f);
   particleSystemSettings.ColorDeath = (VaryingColor) Color.Black;
   particleSystemSettings.FullBright = true;
   particleSystemSettings.RandomizeSpawnTime = true;
   particleSystemSettings.FadeInDuration = 0.25f;
   particleSystemSettings.FadeOutDuration = 0.5f;
   particleSystemSettings.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/dust_particle");
   particleSystemSettings.BlendingMode = BlendingMode.Additive;
   PlaneParticleSystemSettings settings = particleSystemSettings;
   PlaneParticleSystem planeParticleSystem1;
   PlaneParticleSystem planeParticleSystem2 = planeParticleSystem1 = new PlaneParticleSystem(game, maximumCount, settings);
   eldersHexahedron.Particles = planeParticleSystem1;
   PlaneParticleSystem system = planeParticleSystem2;
   planeParticleSystems.Add(system);
   this.Particles.Enabled = false;
   this.LevelManager.LevelChanged += new Action(this.Kill);
 }
Пример #11
0
 private void DoLoad(bool dummy)
 {
   this.LevelManager.ChangeLevel(this.PlayerManager.WarpPanel.Destination);
   this.Phase = GateWarp.Phases.FadeIn;
   this.GameState.SaveData.View = this.PlayerManager.OriginWarpViewpoint;
   this.GameState.SaveData.Ground = Enumerable.First<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.WarpGate)).Position - Vector3.UnitY + FezMath.AsVector(FezMath.VisibleOrientation(this.GameState.SaveData.View)) * 2f;
   this.PlayerManager.CheckpointGround = (TrileInstance) null;
   this.PlayerManager.RespawnAtCheckpoint();
   this.CameraManager.Center = this.PlayerManager.Position + Vector3.Up * this.PlayerManager.Size.Y / 2f + Vector3.UnitY;
   this.CameraManager.SnapInterpolation();
   this.LevelMaterializer.CullInstances();
   this.PlayerManager.Hidden = false;
   this.GameState.ScheduleLoadEnd = true;
   this.SinceStarted = TimeSpan.Zero;
   this.PlayerManager.WarpPanel = (WarpPanel) null;
   this.particles = (PlaneParticleSystem) null;
 }
Пример #12
0
 protected override void Begin()
 {
   base.Begin();
   this.SinceStarted = TimeSpan.Zero;
   this.PlayerManager.LookingDirection = HorizontalDirection.Left;
   this.SinceRisen = TimeSpan.Zero;
   this.Phase = GateWarp.Phases.Rise;
   foreach (SoundEmitter soundEmitter in this.SoundManager.Emitters)
     soundEmitter.FadeOutAndDie(2f);
   this.SoundManager.FadeFrequencies(true, 2f);
   this.SoundManager.FadeVolume(this.SoundManager.MusicVolumeFactor, 0.0f, 3f);
   SoundEffectExtensions.EmitAt(this.WarpSound, this.PlayerManager.Position);
   this.rgbPlanes = (Mesh) null;
   this.particles = (PlaneParticleSystem) null;
   this.sinceInitialized = 0.0f;
   this.originalCenter = this.CameraManager.Center;
   this.CameraManager.Constrained = true;
   this.GateAo = Enumerable.FirstOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.WarpGate));
   if (this.GateAo == null || this.GameState.SaveData.UnlockedWarpDestinations.Count <= 1)
     return;
   this.InitializeRgbGate();
 }
Пример #13
0
 private void CreateParticleSystems()
 {
   if (this.LevelManager.WaterType == LiquidType.None)
     return;
   LiquidColorScheme liquidColorScheme = LiquidHost.ColorSchemes[this.LevelManager.WaterType];
   switch (this.LevelManager.WaterType)
   {
     case LiquidType.Lava:
     case LiquidType.Sewer:
       Color color = new Color(liquidColorScheme.SubmergedFoam.ToVector3() * 0.5f);
       PlaneParticleSystemSettings particleSystemSettings1 = new PlaneParticleSystemSettings();
       particleSystemSettings1.Velocity = (VaryingVector3) new Vector3(0.0f, 0.15f, 0.0f);
       particleSystemSettings1.Gravity = new Vector3(0.0f, 0.0f, 0.0f);
       particleSystemSettings1.SpawningSpeed = 50f;
       particleSystemSettings1.ParticleLifetime = 2.2f;
       particleSystemSettings1.SpawnBatchSize = 1;
       PlaneParticleSystemSettings particleSystemSettings2 = particleSystemSettings1;
       VaryingVector3 varyingVector3_1 = new VaryingVector3();
       varyingVector3_1.Base = new Vector3(1.0 / 16.0);
       varyingVector3_1.Variation = new Vector3(1.0 / 16.0);
       varyingVector3_1.Function = VaryingVector3.Uniform;
       VaryingVector3 varyingVector3_2 = varyingVector3_1;
       particleSystemSettings2.SizeBirth = varyingVector3_2;
       PlaneParticleSystemSettings particleSystemSettings3 = particleSystemSettings1;
       VaryingVector3 varyingVector3_3 = new VaryingVector3();
       varyingVector3_3.Base = new Vector3(0.125f);
       varyingVector3_3.Variation = new Vector3(0.125f);
       varyingVector3_3.Function = VaryingVector3.Uniform;
       VaryingVector3 varyingVector3_4 = varyingVector3_3;
       particleSystemSettings3.SizeDeath = varyingVector3_4;
       particleSystemSettings1.FadeInDuration = 0.1f;
       particleSystemSettings1.FadeOutDuration = 0.1f;
       PlaneParticleSystemSettings particleSystemSettings4 = particleSystemSettings1;
       VaryingColor varyingColor1 = new VaryingColor();
       varyingColor1.Base = color;
       varyingColor1.Variation = color;
       varyingColor1.Function = VaryingColor.Uniform;
       VaryingColor varyingColor2 = varyingColor1;
       particleSystemSettings4.ColorLife = varyingColor2;
       particleSystemSettings1.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/white_square");
       particleSystemSettings1.BlendingMode = BlendingMode.Alphablending;
       particleSystemSettings1.Billboarding = true;
       PlaneParticleSystemSettings settings1 = particleSystemSettings1;
       IPlaneParticleSystems planeParticleSystems1 = this.PlaneParticleSystems;
       LiquidHost liquidHost1 = this;
       PlaneParticleSystem planeParticleSystem1 = new PlaneParticleSystem(this.Game, 100, settings1);
       planeParticleSystem1.DrawOrder = this.DrawOrder + 1;
       PlaneParticleSystem planeParticleSystem2;
       PlaneParticleSystem planeParticleSystem3 = planeParticleSystem2 = planeParticleSystem1;
       liquidHost1.BubbleSystem = planeParticleSystem2;
       PlaneParticleSystem system1 = planeParticleSystem3;
       planeParticleSystems1.Add(system1);
       if (this.LevelManager.WaterType == LiquidType.Sewer)
         break;
       PlaneParticleSystemSettings particleSystemSettings5 = new PlaneParticleSystemSettings();
       PlaneParticleSystemSettings particleSystemSettings6 = particleSystemSettings5;
       VaryingVector3 varyingVector3_5 = new VaryingVector3();
       varyingVector3_5.Variation = new Vector3(1f);
       VaryingVector3 varyingVector3_6 = varyingVector3_5;
       particleSystemSettings6.Velocity = varyingVector3_6;
       particleSystemSettings5.Gravity = new Vector3(0.0f, 0.01f, 0.0f);
       particleSystemSettings5.SpawningSpeed = 40f;
       particleSystemSettings5.ParticleLifetime = 2f;
       particleSystemSettings5.SpawnBatchSize = 1;
       particleSystemSettings5.RandomizeSpawnTime = true;
       PlaneParticleSystemSettings particleSystemSettings7 = particleSystemSettings5;
       VaryingVector3 varyingVector3_7 = new VaryingVector3();
       varyingVector3_7.Function = LiquidHost.EmberScaling;
       VaryingVector3 varyingVector3_8 = varyingVector3_7;
       particleSystemSettings7.SizeBirth = varyingVector3_8;
       particleSystemSettings5.FadeInDuration = 0.15f;
       particleSystemSettings5.FadeOutDuration = 0.4f;
       particleSystemSettings5.ColorBirth = (VaryingColor) new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
       particleSystemSettings5.ColorLife.Base = new Color((int) byte.MaxValue, 16, 16);
       particleSystemSettings5.ColorLife.Variation = new Color(0, 32, 32);
       particleSystemSettings5.ColorLife.Function = VaryingColor.Uniform;
       particleSystemSettings5.ColorDeath = (VaryingColor) new Color(0, 0, 0, 32);
       particleSystemSettings5.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/white_square");
       particleSystemSettings5.BlendingMode = BlendingMode.Alphablending;
       particleSystemSettings5.Billboarding = true;
       PlaneParticleSystemSettings settings2 = particleSystemSettings5;
       IPlaneParticleSystems planeParticleSystems2 = this.PlaneParticleSystems;
       LiquidHost liquidHost2 = this;
       PlaneParticleSystem planeParticleSystem4 = new PlaneParticleSystem(this.Game, 50, settings2);
       planeParticleSystem4.DrawOrder = this.DrawOrder + 1;
       PlaneParticleSystem planeParticleSystem5;
       PlaneParticleSystem planeParticleSystem6 = planeParticleSystem5 = planeParticleSystem4;
       liquidHost2.EmbersSystem = planeParticleSystem5;
       PlaneParticleSystem system2 = planeParticleSystem6;
       planeParticleSystems2.Add(system2);
       break;
   }
 }
Пример #14
0
 private void TryInitialize()
 {
   foreach (WaterfallsHost.WaterfallState waterfallState in this.Waterfalls)
     waterfallState.Dispose();
   this.Waterfalls.Clear();
   foreach (BackgroundPlane plane in Enumerable.ToArray<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values))
   {
     if (plane.ActorType == ActorType.Waterfall || plane.ActorType == ActorType.Trickle)
     {
       Vector3 vector3_1 = Vector3.Transform(plane.Size * plane.Scale * Vector3.UnitX / 2f, plane.Rotation);
       Vector3 vector = Vector3.Transform(Vector3.UnitZ, plane.Rotation);
       Vector3 vector3_2 = FezMath.XZMask - FezMath.Abs(vector);
       Vector3 vector3_3 = plane.Position + plane.Size * plane.Scale * Vector3.UnitY / 2f - new Vector3(0.0f, 1.0 / 32.0, 0.0f) - vector * 2f / 16f;
       Game game = this.Game;
       int maximumCount = 25;
       PlaneParticleSystemSettings particleSystemSettings1 = new PlaneParticleSystemSettings();
       particleSystemSettings1.SpawnVolume = new BoundingBox()
       {
         Min = vector3_3 - vector3_1,
         Max = vector3_3 + vector3_1
       };
       PlaneParticleSystemSettings particleSystemSettings2 = particleSystemSettings1;
       VaryingVector3 varyingVector3_1 = new VaryingVector3();
       varyingVector3_1.Base = Vector3.Up * 1.6f + vector / 4f;
       varyingVector3_1.Variation = Vector3.Up * 0.8f + vector / 4f + vector3_2 / 2f;
       VaryingVector3 varyingVector3_2 = varyingVector3_1;
       particleSystemSettings2.Velocity = varyingVector3_2;
       particleSystemSettings1.Gravity = new Vector3(0.0f, -0.15f, 0.0f);
       particleSystemSettings1.SpawningSpeed = 5f;
       particleSystemSettings1.RandomizeSpawnTime = true;
       particleSystemSettings1.ParticleLifetime = 2f;
       particleSystemSettings1.FadeInDuration = 0.0f;
       particleSystemSettings1.FadeOutDuration = 0.1f;
       particleSystemSettings1.SizeBirth = (VaryingVector3) new Vector3(1.0 / 16.0);
       particleSystemSettings1.ColorLife = (VaryingColor) (this.LevelManager.WaterType == LiquidType.Sewer ? new Color(215, 232, 148) : new Color(1f, 1f, 1f, 0.75f));
       particleSystemSettings1.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/white_square");
       particleSystemSettings1.BlendingMode = BlendingMode.Alphablending;
       particleSystemSettings1.ClampToTrixels = true;
       particleSystemSettings1.Billboarding = true;
       particleSystemSettings1.FullBright = this.LevelManager.WaterType == LiquidType.Sewer;
       particleSystemSettings1.UseCallback = true;
       PlaneParticleSystemSettings settings = particleSystemSettings1;
       PlaneParticleSystem planeParticleSystem = new PlaneParticleSystem(game, maximumCount, settings);
       if (this.LevelManager.WaterType == LiquidType.Sewer)
       {
         planeParticleSystem.DrawOrder = 20;
         planeParticleSystem.Settings.StencilMask = new StencilMask?(StencilMask.Level);
       }
       this.PlaneParticleSystems.Add(planeParticleSystem);
       this.Waterfalls.Add(new WaterfallsHost.WaterfallState(plane, planeParticleSystem, this));
     }
     else if (plane.ActorType == ActorType.Drips)
     {
       Vector3 vector3_1 = new Vector3(plane.Size.X, 0.0f, plane.Size.X) / 2f;
       Vector3 vector3_2 = Vector3.Transform(Vector3.UnitZ, plane.Rotation);
       Vector3 vector3_3 = FezMath.XZMask - FezMath.Abs(vector3_2);
       Vector3 vector3_4 = plane.Position - new Vector3(0.0f, 0.125f, 0.0f);
       bool flag = plane.Crosshatch || plane.Billboard;
       Game game = this.Game;
       int maximumCount = 25;
       PlaneParticleSystemSettings particleSystemSettings1 = new PlaneParticleSystemSettings();
       particleSystemSettings1.SpawnVolume = new BoundingBox()
       {
         Min = vector3_4 - vector3_1,
         Max = vector3_4 + vector3_1
       };
       PlaneParticleSystemSettings particleSystemSettings2 = particleSystemSettings1;
       VaryingVector3 varyingVector3_1 = new VaryingVector3();
       varyingVector3_1.Base = Vector3.Zero;
       varyingVector3_1.Variation = Vector3.Zero;
       VaryingVector3 varyingVector3_2 = varyingVector3_1;
       particleSystemSettings2.Velocity = varyingVector3_2;
       particleSystemSettings1.Gravity = new Vector3(0.0f, -0.15f, 0.0f);
       particleSystemSettings1.SpawningSpeed = 2f;
       particleSystemSettings1.RandomizeSpawnTime = true;
       particleSystemSettings1.ParticleLifetime = 2f;
       particleSystemSettings1.FadeInDuration = 0.0f;
       particleSystemSettings1.FadeOutDuration = 0.0f;
       particleSystemSettings1.SizeBirth = (VaryingVector3) new Vector3(1.0 / 16.0);
       particleSystemSettings1.ColorLife = (VaryingColor) (this.LevelManager.WaterType == LiquidType.Sewer ? new Color(215, 232, 148) : Color.White);
       particleSystemSettings1.Texture = this.CMProvider.Global.Load<Texture2D>("Background Planes/white_square");
       particleSystemSettings1.BlendingMode = BlendingMode.Alphablending;
       particleSystemSettings1.ClampToTrixels = true;
       particleSystemSettings1.FullBright = true;
       PlaneParticleSystemSettings settings = particleSystemSettings1;
       PlaneParticleSystem system = new PlaneParticleSystem(game, maximumCount, settings);
       if (this.LevelManager.WaterType == LiquidType.Sewer)
       {
         system.DrawOrder = 20;
         system.Settings.StencilMask = new StencilMask?(StencilMask.Level);
       }
       if (flag)
       {
         system.Settings.Billboarding = true;
         system.Settings.SpawnVolume = new BoundingBox()
         {
           Min = vector3_4 - vector3_1,
           Max = vector3_4 + vector3_1
         };
       }
       else
       {
         system.Settings.Doublesided = plane.Doublesided;
         system.Settings.SpawnVolume = new BoundingBox()
         {
           Min = vector3_4 - vector3_1 * vector3_3,
           Max = vector3_4 + vector3_1 * vector3_3
         };
         system.Settings.Orientation = new FaceOrientation?(FezMath.OrientationFromDirection(vector3_2));
       }
       this.PlaneParticleSystems.Add(system);
     }
   }
 }
Пример #15
0
 public WaterfallState(BackgroundPlane plane, PlaneParticleSystem ps, WaterfallsHost host)
 {
   WaterfallsHost.WaterfallState waterfallState = this;
   ServiceHelper.InjectServices((object) this);
   this.Host = host;
   this.Plane = plane;
   this.ParticleSystem = ps;
   bool flag = plane.ActorType == ActorType.Trickle;
   this.Splash = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.LevelManager.WaterType != LiquidType.Sewer ? (this.LevelManager.WaterType != LiquidType.Purple ? this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water/" + (flag ? "water_small_splash" : "water_large_splash")) : this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/waterPink/" + (flag ? "water_small_splash" : "water_large_splash"))) : this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/sewer/" + (flag ? "sewer_small_splash" : "sewer_large_splash")))
   {
     Doublesided = true,
     Crosshatch = true
   };
   this.LevelManager.AddPlane(this.Splash);
   this.Top = FezMath.Dot(this.Plane.Position + this.Plane.Scale * this.Plane.Size / 2f, Vector3.UnitY);
   this.TerminalPosition = this.Plane.Position - this.Plane.Scale * this.Plane.Size / 2f * Vector3.UnitY + Vector3.Transform(Vector3.UnitZ, plane.Rotation) / 16f;
   foreach (BackgroundPlane backgroundPlane in Enumerable.Where<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x =>
   {
     int? local_0 = x.AttachedPlane;
     int local_1 = plane.Id;
     if ((local_0.GetValueOrDefault() != local_1 ? 0 : (local_0.HasValue ? 1 : 0)) != 0)
       return FezMath.AlmostEqual(Vector3.Transform(Vector3.UnitZ, plane.Rotation).Y, 0.0f);
     else
       return false;
   })))
     this.AttachedPlanes.Add(backgroundPlane);
   Vector3 position = this.LevelManager.WaterType == LiquidType.None ? this.Top * Vector3.UnitY + this.Plane.Position * FezMath.XZMask : this.TerminalPosition * FezMath.XZMask + this.LevelManager.WaterHeight * Vector3.UnitY;
   Waiters.Wait((double) RandomHelper.Between(0.0, 1.0), (Action) (() => waterfallState.BubblingEmitter = SoundEffectExtensions.EmitAt(waterfallState.Host.SewageFallSound, position, true, RandomHelper.Centered(0.025), 0.0f)));
 }