Exemple #1
0
        public void SetLayers(Layer lightEffectLayer)
        {
            if (CreatesLight && LightSpriteList.Count == 0)
            {
                LightSpriteInstance.TextureScale = NormalizedLightRadius;
                SpriteManager.AddToLayer(LightSpriteInstance, lightEffectLayer);
                LightSpriteList.Add(LightSpriteInstance);

                if (CurrentPropNameState == PropName.StreetLight)
                {
                    LightSpriteInstance.RelativeY -= 16f;
                }

                if (CurrentPropNameState == PropName.TriStreetLight)
                {
                    //Otherwise the player can walk right over the lights
                    this.Z = 7;

                    var newLight1 = LightSpriteInstance.Clone();
                    var newLight2 = newLight1.Clone();

                    newLight1.AttachTo(this, false);
                    newLight2.AttachTo(this, false);

                    SpriteManager.AddSprite(newLight1);
                    SpriteManager.AddSprite(newLight2);
                    SpriteManager.AddToLayer(newLight1, lightEffectLayer);
                    SpriteManager.AddToLayer(newLight2, lightEffectLayer);

                    //Left of middle, slightly lower
                    newLight1.RelativeX += -16;
                    newLight1.RelativeY -= 16;

                    //Right of middle, slightly lower
                    newLight2.RelativeX -= 16;
                    newLight2.RelativeY -= 16;

                    LightSpriteList.Add(newLight1);
                    LightSpriteList.Add(newLight2);
                }
            }
        }
        public override void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            base.PostInitialize();
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            base.SpriteInstance.Texture                      = AllParticles;
            base.SpriteInstance.LeftTexturePixel             = 1949f;
            base.SpriteInstance.RightTexturePixel            = 2037f;
            base.SpriteInstance.TopTexturePixel              = 1724f;
            base.SpriteInstance.BottomTexturePixel           = 1825f;
            base.SpriteInstance.TextureScale                 = 1f;
            base.SpriteInstance.UseAnimationRelativePosition = false;
            base.SpriteInstance.AnimationChains              = BaseStructureAnimationChainListFile;
            base.SpriteInstance.CurrentChainName             = "BombardingTower";
            if (mAxisAlignedRectangleInstance.Parent == null)
            {
                mAxisAlignedRectangleInstance.CopyAbsoluteToRelative();
                mAxisAlignedRectangleInstance.AttachTo(this, false);
            }
            base.AxisAlignedRectangleInstance.Width  = 64f;
            base.AxisAlignedRectangleInstance.Height = 64f;
            if (LightSpriteInstance.Parent == null)
            {
                LightSpriteInstance.CopyAbsoluteToRelative();
                LightSpriteInstance.AttachTo(this, false);
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.X = 0f;
            }
            else
            {
                base.LightSpriteInstance.RelativeX = 0f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Y = 30f;
            }
            else
            {
                base.LightSpriteInstance.RelativeY = 30f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Z = -1f;
            }
            else
            {
                base.LightSpriteInstance.RelativeZ = -1f;
            }
            base.LightSpriteInstance.LeftTexturePixel   = 1792f;
            base.LightSpriteInstance.RightTexturePixel  = 2048f;
            base.LightSpriteInstance.TopTexturePixel    = 1792f;
            base.LightSpriteInstance.BottomTexturePixel = 2048f;
            base.LightSpriteInstance.TextureScale       = 1f;
            #if FRB_MDX
            LightSpriteInstance.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate;
            #else
            base.LightSpriteInstance.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            #endif
            base.LightSpriteInstance.Blue  = 0.5f;
            base.LightSpriteInstance.Alpha = 0.25f;
            if (AimSpriteInstance.Parent == null)
            {
                AimSpriteInstance.CopyAbsoluteToRelative();
                AimSpriteInstance.AttachTo(this, false);
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.X = 0f;
            }
            else
            {
                base.AimSpriteInstance.RelativeX = 0f;
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.Y = 78f;
            }
            else
            {
                base.AimSpriteInstance.RelativeY = 78f;
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.Z = 1f;
            }
            else
            {
                base.AimSpriteInstance.RelativeZ = 1f;
            }
            base.AimSpriteInstance.Texture            = AllParticles;
            base.AimSpriteInstance.LeftTexturePixel   = 1939f;
            base.AimSpriteInstance.RightTexturePixel  = 1986f;
            base.AimSpriteInstance.TopTexturePixel    = 1846f;
            base.AimSpriteInstance.BottomTexturePixel = 2002f;
            base.AimSpriteInstance.TextureScale       = 1f;
            if (PivotPoint.Parent == null)
            {
                PivotPoint.CopyAbsoluteToRelative();
                PivotPoint.AttachTo(this, false);
            }
            if (PivotPoint.Parent == null)
            {
                base.PivotPoint.Y = 30f;
            }
            else
            {
                base.PivotPoint.RelativeY = 30f;
            }
            if (LightAimSpriteInstance.Parent == null)
            {
                LightAimSpriteInstance.CopyAbsoluteToRelative();
                LightAimSpriteInstance.AttachTo(this, false);
            }
            if (LightAimSpriteInstance.Parent == null)
            {
                base.LightAimSpriteInstance.Y = 120f;
            }
            else
            {
                base.LightAimSpriteInstance.RelativeY = 120f;
            }
            base.LightAimSpriteInstance.Texture            = AllParticles;
            base.LightAimSpriteInstance.LeftTexturePixel   = 1060f;
            base.LightAimSpriteInstance.RightTexturePixel  = 1122f;
            base.LightAimSpriteInstance.TopTexturePixel    = 1269f;
            base.LightAimSpriteInstance.BottomTexturePixel = 1339f;
            base.LightAimSpriteInstance.TextureScale       = 1f;
            base.LightAimSpriteInstance.Width   = 91f;
            base.LightAimSpriteInstance.Height  = 70f;
            base.LightAimSpriteInstance.Visible = true;
            #if FRB_MDX
            LightAimSpriteInstance.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate;
            #else
            base.LightAimSpriteInstance.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            #endif
            base.LightAimSpriteInstance.Red            = 0.5f;
            base.LightAimSpriteInstance.Green          = 0.23f;
            base.LightAimSpriteInstance.BlendOperation = FlatRedBall.Graphics.BlendOperation.Add;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
        public override void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            base.PostInitialize();
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            base.SpriteInstance.Texture            = AllParticles;
            base.SpriteInstance.LeftTexturePixel   = 1617f;
            base.SpriteInstance.RightTexturePixel  = 1694f;
            base.SpriteInstance.TopTexturePixel    = 1948f;
            base.SpriteInstance.BottomTexturePixel = 2031f;
            base.SpriteInstance.TextureScale       = 1f;
            base.SpriteInstance.AnimationChains    = BaseStructureAnimationChainListFile;
            base.SpriteInstance.CurrentChainName   = "PiercingTower";
            if (mAxisAlignedRectangleInstance.Parent == null)
            {
                mAxisAlignedRectangleInstance.CopyAbsoluteToRelative();
                mAxisAlignedRectangleInstance.AttachTo(this, false);
            }
            base.AxisAlignedRectangleInstance.Width  = 64f;
            base.AxisAlignedRectangleInstance.Height = 64f;
            if (LightSpriteInstance.Parent == null)
            {
                LightSpriteInstance.CopyAbsoluteToRelative();
                LightSpriteInstance.AttachTo(this, false);
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.X = -2.5f;
            }
            else
            {
                base.LightSpriteInstance.RelativeX = -2.5f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Y = 36f;
            }
            else
            {
                base.LightSpriteInstance.RelativeY = 36f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Z = -1f;
            }
            else
            {
                base.LightSpriteInstance.RelativeZ = -1f;
            }
            base.LightSpriteInstance.Texture            = AllParticles;
            base.LightSpriteInstance.LeftTexturePixel   = 1792f;
            base.LightSpriteInstance.RightTexturePixel  = 2048f;
            base.LightSpriteInstance.TopTexturePixel    = 1792f;
            base.LightSpriteInstance.BottomTexturePixel = 2048f;
            base.LightSpriteInstance.TextureScale       = 1f;
            base.LightSpriteInstance.Width  = 1f;
            base.LightSpriteInstance.Height = 1f;
            #if FRB_MDX
            LightSpriteInstance.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate;
            #else
            base.LightSpriteInstance.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            #endif
            base.LightSpriteInstance.Blue  = 0.5f;
            base.LightSpriteInstance.Alpha = 0.25f;
            if (AimSpriteInstance.Parent == null)
            {
                AimSpriteInstance.CopyAbsoluteToRelative();
                AimSpriteInstance.AttachTo(this, false);
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.X = 2f;
            }
            else
            {
                base.AimSpriteInstance.RelativeX = 2f;
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.Y = 46.11102f;
            }
            else
            {
                base.AimSpriteInstance.RelativeY = 46.11102f;
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.Z = 0.1f;
            }
            else
            {
                base.AimSpriteInstance.RelativeZ = 0.1f;
            }
            base.AimSpriteInstance.Texture            = AllParticles;
            base.AimSpriteInstance.LeftTexturePixel   = 1598f;
            base.AimSpriteInstance.RightTexturePixel  = 1782f;
            base.AimSpriteInstance.TopTexturePixel    = 1827f;
            base.AimSpriteInstance.BottomTexturePixel = 1946f;
            base.AimSpriteInstance.TextureScale       = 1f;
            if (ArrowSpriteInstance.Parent == null)
            {
                ArrowSpriteInstance.CopyAbsoluteToRelative();
                ArrowSpriteInstance.AttachTo(this, false);
            }
            if (ArrowSpriteInstance.Parent == null)
            {
                ArrowSpriteInstance.X = 1f;
            }
            else
            {
                ArrowSpriteInstance.RelativeX = 1f;
            }
            if (ArrowSpriteInstance.Parent == null)
            {
                ArrowSpriteInstance.Y = 57.24112f;
            }
            else
            {
                ArrowSpriteInstance.RelativeY = 57.24112f;
            }
            if (ArrowSpriteInstance.Parent == null)
            {
                ArrowSpriteInstance.Z = 0f;
            }
            else
            {
                ArrowSpriteInstance.RelativeZ = 0f;
            }
            ArrowSpriteInstance.Texture            = AllParticles;
            ArrowSpriteInstance.LeftTexturePixel   = 2019f;
            ArrowSpriteInstance.RightTexturePixel  = 2034f;
            ArrowSpriteInstance.TopTexturePixel    = 1571f;
            ArrowSpriteInstance.BottomTexturePixel = 1712f;
            ArrowSpriteInstance.TextureScale       = 1f;
            if (PivotPoint.Parent == null)
            {
                PivotPoint.CopyAbsoluteToRelative();
                PivotPoint.AttachTo(this, false);
            }
            if (PivotPoint.Parent == null)
            {
                base.PivotPoint.X = -2.5f;
            }
            else
            {
                base.PivotPoint.RelativeX = -2.5f;
            }
            if (PivotPoint.Parent == null)
            {
                base.PivotPoint.Y = 36f;
            }
            else
            {
                base.PivotPoint.RelativeY = 36f;
            }
            if (LightAimSpriteInstance.Parent == null)
            {
                LightAimSpriteInstance.CopyAbsoluteToRelative();
                LightAimSpriteInstance.AttachTo(this, false);
            }
            base.LightAimSpriteInstance.Texture         = AllParticles;
            base.LightAimSpriteInstance.TextureScale    = 1f;
            base.LightAimSpriteInstance.AnimationChains = StructureGlowAnimationChainList;
            base.LightAimSpriteInstance.Visible         = false;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Exemple #4
0
        public override void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            base.PostInitialize();
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            base.SpriteInstance.Texture            = AllParticles;
            base.SpriteInstance.LeftTexturePixel   = 1622f;
            base.SpriteInstance.RightTexturePixel  = 1746f;
            base.SpriteInstance.TopTexturePixel    = 1568f;
            base.SpriteInstance.BottomTexturePixel = 1789f;
            base.SpriteInstance.TextureScale       = 1f;
            base.SpriteInstance.AnimationChains    = BaseStructureAnimationChainListFile;
            base.SpriteInstance.CurrentChainName   = "ElectricTower";
            if (mAxisAlignedRectangleInstance.Parent == null)
            {
                mAxisAlignedRectangleInstance.CopyAbsoluteToRelative();
                mAxisAlignedRectangleInstance.AttachTo(this, false);
            }
            base.AxisAlignedRectangleInstance.Width  = 64f;
            base.AxisAlignedRectangleInstance.Height = 64f;
            if (LightSpriteInstance.Parent == null)
            {
                LightSpriteInstance.CopyAbsoluteToRelative();
                LightSpriteInstance.AttachTo(this, false);
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.X = 15f;
            }
            else
            {
                base.LightSpriteInstance.RelativeX = 15f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Y = 95f;
            }
            else
            {
                base.LightSpriteInstance.RelativeY = 95f;
            }
            if (LightSpriteInstance.Parent == null)
            {
                base.LightSpriteInstance.Z = -1f;
            }
            else
            {
                base.LightSpriteInstance.RelativeZ = -1f;
            }
            base.LightSpriteInstance.LeftTexturePixel   = 1792f;
            base.LightSpriteInstance.RightTexturePixel  = 2048f;
            base.LightSpriteInstance.TopTexturePixel    = 1792f;
            base.LightSpriteInstance.BottomTexturePixel = 2048f;
            base.LightSpriteInstance.TextureScale       = 1f;
            base.LightSpriteInstance.Width            = 1f;
            base.LightSpriteInstance.Height           = 1f;
            base.LightSpriteInstance.AnimationChains  = StructureGlowAnimationChainList;
            base.LightSpriteInstance.CurrentChainName = "ElectricGlow";
            #if FRB_MDX
            LightSpriteInstance.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate;
            #else
            base.LightSpriteInstance.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            #endif
            base.LightSpriteInstance.Blue  = 0.5f;
            base.LightSpriteInstance.Alpha = 0.5f;
            if (AimSpriteInstance.Parent == null)
            {
                AimSpriteInstance.CopyAbsoluteToRelative();
                AimSpriteInstance.AttachTo(this, false);
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.X = 16.07512f;
            }
            else
            {
                base.AimSpriteInstance.RelativeX = 16.07512f;
            }
            if (AimSpriteInstance.Parent == null)
            {
                base.AimSpriteInstance.Y = 97.46671f;
            }
            else
            {
                base.AimSpriteInstance.RelativeY = 97.46671f;
            }
            base.AimSpriteInstance.Texture            = AllParticles;
            base.AimSpriteInstance.LeftTexturePixel   = 1635f;
            base.AimSpriteInstance.RightTexturePixel  = 1636f;
            base.AimSpriteInstance.TopTexturePixel    = 1579f;
            base.AimSpriteInstance.BottomTexturePixel = 1580f;
            base.AimSpriteInstance.TextureScale       = 1f;
            if (PivotPoint.Parent == null)
            {
                PivotPoint.CopyAbsoluteToRelative();
                PivotPoint.AttachTo(this, false);
            }
            if (PivotPoint.Parent == null)
            {
                base.PivotPoint.X = 15f;
            }
            else
            {
                base.PivotPoint.RelativeX = 15f;
            }
            if (PivotPoint.Parent == null)
            {
                base.PivotPoint.Y = 95f;
            }
            else
            {
                base.PivotPoint.RelativeY = 95f;
            }
            if (LightAimSpriteInstance.Parent == null)
            {
                LightAimSpriteInstance.CopyAbsoluteToRelative();
                LightAimSpriteInstance.AttachTo(this, false);
            }
            base.LightAimSpriteInstance.Texture                      = AllParticles;
            base.LightAimSpriteInstance.LeftTexturePixel             = 0f;
            base.LightAimSpriteInstance.RightTexturePixel            = 1f;
            base.LightAimSpriteInstance.TopTexturePixel              = 0f;
            base.LightAimSpriteInstance.BottomTexturePixel           = 1f;
            base.LightAimSpriteInstance.TextureScale                 = 1f;
            base.LightAimSpriteInstance.UseAnimationRelativePosition = false;
            base.LightAimSpriteInstance.Animate                      = false;
            base.LightAimSpriteInstance.Visible                      = false;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }