示例#1
0
        private void TryInitialize()
        {
            this.Destroy();
            this.Visible = this.Enabled = this.LevelManager.Name == "HEX_REBUILD";
            if (!this.Enabled)
            {
                return;
            }
            this.GameState.HideHUD = true;
            this.CameraManager.ChangeViewpoint(Viewpoint.Right, 0.0f);
            this.PlayerManager.Background = false;
            ArtObject artObject = this.CMProvider.CurrentLevel.Load <ArtObject>("Art Objects/NEW_HEXAO");
            int       key       = IdentifierPool.FirstAvailable <ArtObjectInstance>(this.LevelManager.ArtObjects);

            this.HexahedronAo = new ArtObjectInstance(artObject)
            {
                Id = key
            };
            this.LevelManager.ArtObjects.Add(key, this.HexahedronAo);
            this.HexahedronAo.Initialize();
            this.HexahedronAo.Hidden = true;
            this.WhiteCube           = new Mesh()
            {
                Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                Blending    = new BlendingMode?(BlendingMode.Additive),
                DepthWrites = false
            };
            this.WhiteCube.Rotation = this.CameraManager.Rotation * Quaternion.CreateFromRotationMatrix(Matrix.CreateLookAt(Vector3.One, Vector3.Zero, Vector3.Up));
            this.WhiteCube.AddColoredBox(new Vector3(4f), Vector3.Zero, Color.White, true);
            FinalRebuildHost finalRebuildHost = this;
            Mesh             mesh1            = new Mesh();
            Mesh             mesh2            = mesh1;

            DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
            litTextured1.Specular        = true;
            litTextured1.Emissive        = 0.5f;
            litTextured1.AlphaIsEmissive = true;
            DefaultEffect.LitTextured litTextured2 = litTextured1;
            mesh2.Effect   = (BaseEffect)litTextured2;
            mesh1.Blending = new BlendingMode?(BlendingMode.Opaque);
            Mesh mesh3 = mesh1;

            finalRebuildHost.SolidCubes = mesh3;
            this.OriginalCubeRotation   = this.SolidCubes.Rotation = this.WhiteCube.Rotation;
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.CubeShard)).Geometry;
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry2 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)).Geometry;

            this.sHexAppear      = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/HexAppear");
            this.sCubeAppear     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/CubeAppear");
            this.sMotorSpin1     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStart1");
            this.sMotorSpin2     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStart2");
            this.sMotorSpinAOK   = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStartAOK");
            this.sMotorSpinCrash = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStartCrash");
            this.sRayWhiteout    = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/RayWhiteout");
            this.sAku            = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/Aku");
            this.sZoomIn         = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/ZoomIn");
            this.sAmbientDrone   = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/AmbientDrone");
            for (int index = 0; index < Math.Min(this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes, 64); ++index)
            {
                Vector3 vector3 = this.CubeOffsets[index];
                ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> indexedPrimitives = index < this.GameState.SaveData.CubeShards ? geometry1 : geometry2;
                Group group = this.SolidCubes.AddGroup();
                group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)indexedPrimitives.Vertices), indexedPrimitives.Indices, indexedPrimitives.PrimitiveType);
                group.Position = vector3;
                group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float)RandomHelper.Random.Next(0, 4) * 1.570796f);
                group.Enabled  = false;
                group.Material = new Material();
            }
            this.SolidCubes.Texture = this.LevelMaterializer.TrilesMesh.Texture;
            this.InvertEffect       = new InvertEffect();
            this.RaysMesh           = new Mesh()
            {
                Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                Blending    = new BlendingMode?(BlendingMode.Additive),
                DepthWrites = false
            };
            this.FlareMesh = 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.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
            this.RtHandle = this.TargetRenderer.TakeTarget();
            this.TargetRenderer.ScheduleHook(this.DrawOrder, this.RtHandle.Target);
            ServiceHelper.AddComponent((IGameComponent)(this.Glitches = new NesGlitches(this.Game)));
        }
示例#2
0
 private void ChangePhaseTo(FinalRebuildHost.Phases phase)
 {
   this.PhaseTime = 0.0f;
   this.ActivePhase = phase;
   this.Update(new GameTime());
 }