Exemple #1
0
 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();
 }
Exemple #2
0
 static ArtObjectInstance()
 {
     if (!ServiceHelper.IsFull)
     {
         return;
     }
     ArtObjectInstance.LevelMaterializer = ServiceHelper.Get <ILevelMaterializer>();
 }
Exemple #3
0
 public GlitchyRespawner(Game game, TrileInstance instance, bool soundEmitter)
   : base(game)
 {
   this.UpdateOrder = -2;
   this.DrawOrder = 10;
   this.Instance = instance;
   this.EmitOrNot = soundEmitter;
   this.TargetRenderer = ServiceHelper.Get<ITargetRenderingManager>();
   this.LightingPostProcess = ServiceHelper.Get<ILightingPostProcess>();
   this.LevelMaterializer = ServiceHelper.Get<ILevelMaterializer>();
   this.GameState = ServiceHelper.Get<IGameStateManager>();
   this.CameraManager = ServiceHelper.Get<IDefaultCameraManager>();
   this.LevelManager = ServiceHelper.Get<IGameLevelManager>();
   this.CMProvider = ServiceHelper.Get<IContentManagerProvider>();
 }
Exemple #4
0
 public GlitchyRespawner(Game game, TrileInstance instance, bool soundEmitter)
     : base(game)
 {
     this.UpdateOrder         = -2;
     this.DrawOrder           = 10;
     this.Instance            = instance;
     this.EmitOrNot           = soundEmitter;
     this.TargetRenderer      = ServiceHelper.Get <ITargetRenderingManager>();
     this.LightingPostProcess = ServiceHelper.Get <ILightingPostProcess>();
     this.LevelMaterializer   = ServiceHelper.Get <ILevelMaterializer>();
     this.GameState           = ServiceHelper.Get <IGameStateManager>();
     this.CameraManager       = ServiceHelper.Get <IDefaultCameraManager>();
     this.LevelManager        = ServiceHelper.Get <IGameLevelManager>();
     this.CMProvider          = ServiceHelper.Get <IContentManagerProvider>();
 }
Exemple #5
0
 public SwooshingCube(TrileInstance instance, Mesh destinationMesh, Vector3 Offset, Quaternion Rotation)
 {
   this.CameraManager = ServiceHelper.Get<IGameCameraManager>();
   this.LevelManager = ServiceHelper.Get<ILevelManager>();
   this.LevelMaterializer = ServiceHelper.Get<ILevelMaterializer>();
   this.rotation = Rotation;
   this.positionOffset = Offset;
   this.color = this.StandardTrail;
   switch (this.LevelManager.WaterType)
   {
     case LiquidType.Lava:
       this.color = this.RedTrail;
       break;
     case LiquidType.Sewer:
       this.color = this.SewerTrail;
       break;
   }
   if (this.LevelManager.BlinkingAlpha)
     this.color = this.CMYTrail;
   this.Trail = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     Culling = CullMode.None,
     Blending = new BlendingMode?(BlendingMode.Additive),
     AlwaysOnTop = true
   };
   this.Cube = new Mesh()
   {
     Texture = this.LevelMaterializer.TrilesMesh.Texture
   };
   if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
   {
     Mesh mesh = this.Cube;
     DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
     textured1.AlphaIsEmissive = true;
     DefaultEffect.Textured textured2 = textured1;
     mesh.Effect = (BaseEffect) textured2;
   }
   else
   {
     Mesh mesh = this.Cube;
     DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
     litTextured1.Specular = true;
     litTextured1.Emissive = 0.5f;
     litTextured1.AlphaIsEmissive = true;
     DefaultEffect.LitTextured litTextured2 = litTextured1;
     mesh.Effect = (BaseEffect) litTextured2;
   }
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = instance.Trile.Geometry;
   this.Cube.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
   this.Trail.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.TrailGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(this.TrailVertices = new FezVertexPositionColor[0], this.TrailIndices = new int[0], PrimitiveType.TriangleList));
   this.Instance = instance;
   this.lastPoint = instance.Center;
   this.DestinationMesh = destinationMesh;
   this.sideDirection = (RandomHelper.Probability(0.5) ? -1f : 1f) * FezMath.RightVector(this.CameraManager.Viewpoint);
   this.Spline = new Vector3SplineInterpolation(TimeSpan.FromSeconds(3.0), new Vector3[10]);
   this.Spline.Start();
   this.AddSegment();
 }
Exemple #6
0
            public SwooshingCube(TrileInstance instance, Mesh destinationMesh, Vector3 Offset, Quaternion Rotation)
            {
                this.CameraManager     = ServiceHelper.Get <IGameCameraManager>();
                this.LevelManager      = ServiceHelper.Get <ILevelManager>();
                this.LevelMaterializer = ServiceHelper.Get <ILevelMaterializer>();
                this.rotation          = Rotation;
                this.positionOffset    = Offset;
                this.color             = this.StandardTrail;
                switch (this.LevelManager.WaterType)
                {
                case LiquidType.Lava:
                    this.color = this.RedTrail;
                    break;

                case LiquidType.Sewer:
                    this.color = this.SewerTrail;
                    break;
                }
                if (this.LevelManager.BlinkingAlpha)
                {
                    this.color = this.CMYTrail;
                }
                this.Trail = new Mesh()
                {
                    Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                    Culling     = CullMode.None,
                    Blending    = new BlendingMode?(BlendingMode.Additive),
                    AlwaysOnTop = true
                };
                this.Cube = new Mesh()
                {
                    Texture = this.LevelMaterializer.TrilesMesh.Texture
                };
                if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
                {
                    Mesh mesh = this.Cube;
                    DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
                    textured1.AlphaIsEmissive = true;
                    DefaultEffect.Textured textured2 = textured1;
                    mesh.Effect = (BaseEffect)textured2;
                }
                else
                {
                    Mesh mesh = this.Cube;
                    DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
                    litTextured1.Specular        = true;
                    litTextured1.Emissive        = 0.5f;
                    litTextured1.AlphaIsEmissive = true;
                    DefaultEffect.LitTextured litTextured2 = litTextured1;
                    mesh.Effect = (BaseEffect)litTextured2;
                }
                ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = instance.Trile.Geometry;

                this.Cube.AddGroup().Geometry  = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
                this.Trail.AddGroup().Geometry = (IIndexedPrimitiveCollection)(this.TrailGeometry = new IndexedUserPrimitives <FezVertexPositionColor>(this.TrailVertices = new FezVertexPositionColor[0], this.TrailIndices = new int[0], PrimitiveType.TriangleList));
                this.Instance        = instance;
                this.lastPoint       = instance.Center;
                this.DestinationMesh = destinationMesh;
                this.sideDirection   = (RandomHelper.Probability(0.5) ? -1f : 1f) * FezMath.RightVector(this.CameraManager.Viewpoint);
                this.Spline          = new Vector3SplineInterpolation(TimeSpan.FromSeconds(3.0), new Vector3[10]);
                this.Spline.Start();
                this.AddSegment();
            }
Exemple #7
0
 static ArtObjectInstance()
 {
   if (!ServiceHelper.IsFull)
     return;
   ArtObjectInstance.LevelMaterializer = ServiceHelper.Get<ILevelMaterializer>();
 }
Exemple #8
0
 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();
 }