Пример #1
0
        protected override void LoadContent()
        {
            SplitUpCubeHost splitUpCubeHost1 = 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.Alphablending);
            Mesh mesh3 = mesh1;

            splitUpCubeHost1.SolidCubes = mesh3;
            SplitUpCubeHost splitUpCubeHost2 = this;
            Mesh            mesh4            = new Mesh();
            Mesh            mesh5            = mesh4;

            DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
            vertexColored1.Fullbright      = true;
            vertexColored1.AlphaIsEmissive = false;
            DefaultEffect.VertexColored vertexColored2 = vertexColored1;
            mesh5.Effect      = (BaseEffect)vertexColored2;
            mesh4.DepthWrites = false;
            Mesh mesh6 = mesh4;

            splitUpCubeHost2.ChimeOutline = mesh6;
            this.ChimeOutline.AddWireframePolygon(Color.Yellow, new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.3333333f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.1111111f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.03703704f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.sBitChime = this.CMProvider.Global.Load <SoundEffect>("Sounds/Collects/BitChime");
        }
Пример #2
0
 public TrailsRenderer(Game game, SplitUpCubeHost host)
   : base(game)
 {
   this.Host = host;
   this.DrawOrder = 101;
 }
Пример #3
0
 public TrailsRenderer(Game game, SplitUpCubeHost host)
     : base(game)
 {
     this.Host      = host;
     this.DrawOrder = 101;
 }
Пример #4
0
 private void TryInitialize()
 {
     if (this.WireframeCube == null)
     {
         this.WireframeCube = new Mesh()
         {
             Effect   = (BaseEffect)(this.SplitCollectorEffect = new SplitCollectorEffect()),
             Material =
             {
                 Diffuse = Vector3.One,
                 Opacity = 1f
             },
             Blending = new BlendingMode?(BlendingMode.Alphablending)
         };
         for (int index = 0; index < 7; ++index)
         {
             this.WireframeCube.AddWireframeBox(Vector3.One, Vector3.Zero, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 1f : 0.0f), true);
             foreach (Vector3 origin in this.CubeOffsets)
             {
                 this.WireframeCube.AddWireframeBox(Vector3.One / 2f, origin, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 0.625f : 0.375f), true);
             }
         }
         this.WireframeCube.CollapseToBuffer <FezVertexPositionColor>();
     }
     this.SolidCubesVisible = true;
     if (this.TrackedCollects.Count > 0)
     {
         this.GameState.SaveData.CollectedParts += this.TrackedCollects.Count;
         Waiters.Wait(0.5, (Action)(() => Waiters.Wait((Func <bool>)(() =>
         {
             if (this.PlayerManager.CanControl)
             {
                 return(this.PlayerManager.Grounded);
             }
             else
             {
                 return(false);
             }
         }), (Action)(() =>
         {
             this.GomezService.OnCollectedSplitUpCube();
             this.GameState.OnHudElementChanged();
             this.GameState.Save();
             this.TryAssembleCube();
         }))));
     }
     foreach (SplitUpCubeHost.SwooshingCube swooshingCube in this.TrackedCollects)
     {
         swooshingCube.Dispose();
     }
     this.TrackedCollects.Clear();
     if (this.LevelManager.TrileSet == null)
     {
         this.trailsRenderer.Visible = this.Enabled = this.Visible = false;
     }
     else
     {
         Trile goldenCubeTrile = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.GoldenCube));
         IEnumerable <TrileInstance>    source         = Enumerable.Union <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, Enumerable.SelectMany <KeyValuePair <TrileEmplacement, TrileInstance>, TrileInstance>((IEnumerable <KeyValuePair <TrileEmplacement, TrileInstance> >) this.LevelManager.Triles, (Func <KeyValuePair <TrileEmplacement, TrileInstance>, IEnumerable <TrileInstance> >)(x => (IEnumerable <TrileInstance>)x.Value.OverlappedTriles ?? Enumerable.Empty <TrileInstance>())));
         SplitUpCubeHost.TrailsRenderer trailsRenderer = this.trailsRenderer;
         SplitUpCubeHost splitUpCubeHost = this;
         bool            flag1;
         this.Visible = flag1 = goldenCubeTrile != null && (Enumerable.Count <TrileInstance>(source, (Func <TrileInstance, bool>)(x => x.TrileId == goldenCubeTrile.Id)) != 0 || this.AssembleScheduled || this.GameState.SaveData.CollectedParts == 8);
         int  num1;
         bool flag2 = (num1 = flag1 ? 1 : 0) != 0;
         splitUpCubeHost.Enabled = num1 != 0;
         int num2 = flag2 ? 1 : 0;
         trailsRenderer.Visible = num2 != 0;
         if (!this.Enabled)
         {
             return;
         }
         this.RefreshSounds();
         this.TrackedBits.Clear();
         this.TrackedBits.AddRange(Enumerable.Where <TrileInstance>(source, (Func <TrileInstance, bool>)(x => x.TrileId == goldenCubeTrile.Id)));
         this.SolidCubes.ClearGroups();
         ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = goldenCubeTrile.Geometry;
         this.SolidCubes.Position = Vector3.Zero;
         this.SolidCubes.Rotation = Quaternion.Identity;
         foreach (Vector3 vector3 in this.CubeOffsets)
         {
             Group group = this.SolidCubes.AddGroup();
             group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
             group.Position = vector3;
             group.BakeTransform <VertexPositionNormalTextureInstance>();
         }
         this.SolidCubes.Texture  = this.LevelMaterializer.TrilesMesh.Texture;
         this.SolidCubes.Rotation = this.WireframeCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
         this.WireOpacityFactor   = 1f;
         this.SinceNoTrails       = 3f;
         this.ShineOn             = (TrileInstance)null;
         this.UntilNextShine      = 7f;
         if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
         {
             if (this.SolidCubes.Effect is DefaultEffect.LitTextured)
             {
                 Mesh mesh = this.SolidCubes;
                 DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
                 textured1.AlphaIsEmissive = true;
                 textured1.IgnoreCache     = true;
                 DefaultEffect.Textured textured2 = textured1;
                 mesh.Effect = (BaseEffect)textured2;
             }
         }
         else if (this.SolidCubes.Effect is DefaultEffect.Textured)
         {
             Mesh mesh = this.SolidCubes;
             DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
             litTextured1.Specular        = true;
             litTextured1.Emissive        = 0.5f;
             litTextured1.AlphaIsEmissive = true;
             litTextured1.IgnoreCache     = true;
             DefaultEffect.LitTextured litTextured2 = litTextured1;
             mesh.Effect = (BaseEffect)litTextured2;
         }
         this.TryAssembleCube();
     }
 }