Example #1
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);
        }
Example #2
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);
        }