Inheritance: FlatRedBall.PositionedObject
Esempio n. 1
0
        public override void Initialize(bool addToManagers)
        {
			// Generated Initialize
			LoadStaticContent(ContentManagerName);
			if (!FlatRedBall.FlatRedBallServices.IsLoaded<FlatRedBall.Scene>(@"content/screens/mundosmith/scenefile.scnx", ContentManagerName))
			{
			}
			SceneFile = FlatRedBall.FlatRedBallServices.Load<FlatRedBall.Scene>(@"content/screens/mundosmith/scenefile.scnx", ContentManagerName);
			if (!FlatRedBall.FlatRedBallServices.IsLoaded<FlatRedBall.Math.Geometry.ShapeCollection>(@"content/screens/mundosmith/limitesmundo.shcx", ContentManagerName))
			{
			}
			LimitesMundo = FlatRedBall.FlatRedBallServices.Load<FlatRedBall.Math.Geometry.ShapeCollection>(@"content/screens/mundosmith/limitesmundo.shcx", ContentManagerName);
			Fondo = SceneFile.Sprites.FindByName("ship painting1");
			SmithInstance = new TesisEconoFight.Entities.Smith(ContentManagerName, false);
			SmithInstance.Name = "SmithInstance";
			PauseTextInstance = new TesisEconoFight.Entities.PauseText(ContentManagerName, false);
			PauseTextInstance.Name = "PauseTextInstance";
			P2WinTextInstance = new TesisEconoFight.Entities.P2WinText(ContentManagerName, false);
			P2WinTextInstance.Name = "P2WinTextInstance";
			P1WinTextInstance = new TesisEconoFight.Entities.P1WinText(ContentManagerName, false);
			P1WinTextInstance.Name = "P1WinTextInstance";
			DoubleKOTextInstance = new TesisEconoFight.Entities.DoubleKOText(ContentManagerName, false);
			DoubleKOTextInstance.Name = "DoubleKOTextInstance";
			ListaJugadores = new FlatRedBall.Math.PositionedObjectList<TesisEconoFight.Entities.Player>();
			ListaJugadores.Name = "ListaJugadores";
			
			
			PostInitialize();
			base.Initialize(addToManagers);
			if (addToManagers)
			{
				AddToManagers();
			}

        }
        public void TestContainsChainNameExtensionMethod()
        {
            // Setup
            var nullAnimatable = (IAnimationChainAnimatable)null;
            
            var sprite = new Sprite();
            sprite.AnimationChains = new AnimationChainList();
            sprite.AnimationChains.Add(new AnimationChain { Name = "ValidChain" });

            // This causes me to break in Visual Studio
            //Assert.Throws<ArgumentNullException>(delegate { nullAnimatable.ContainsChainName("test"); });
            bool wasThrown = false;
            try
            {
                nullAnimatable.ContainsChainName("test"); 
            }
            catch (ArgumentException)
            {
                wasThrown = true; ;
            }
            Assert.IsTrue(wasThrown);

            Assert.IsTrue(sprite.ContainsChainName("ValidChain"));
            Assert.IsFalse(sprite.ContainsChainName("InvalidChain"));
        }
Esempio n. 3
0
        private void CreateVisibleRepresentation(string contentManagerName)
        {
            string assetToUse = "redball.bmp";
            mVisibleRepresentation.AttachTo(this, false);

            mVisibleRepresentation = SpriteManager.AddSprite(assetToUse, contentManagerName);
        }
Esempio n. 4
0
        public ReactiveHud()
        {			

            mMarkerLayer = SpriteManager.AddLayer();

            #region Create the Sprite Over Marker

            mSpriteOverMarker = SpriteManager.AddSprite(
                FlatRedBallServices.Load<Texture2D>("Content/smallSquareClear.bmp", AppState.Self.PermanentContentManager),
                mMarkerLayer);
            mSpriteOverMarker.RelativeZ = -.0001f;
            mSpriteOverMarker.Visible = false;
            mSpriteOverMarker.Alpha = 100;                

			#endregion

            #region Create the Current Emitter Marker

            mCurrentEmitterMarker = SpriteManager.AddSprite(
                FlatRedBallServices.Load<Texture2D>("Content/smallSquare.bmp", AppState.Self.PermanentContentManager),
                mMarkerLayer);
            mCurrentEmitterMarker.Visible = false;

            #endregion

            mEmissionAreaVisibleRepresentation = new EmissionAreaVisibleRepresentation();
        }
Esempio n. 5
0
        public static void FocusOn(Sprite sprite)
        {
            float distanceAway = 10 * 
                Math.Max(sprite.ScaleX, sprite.ScaleY);

            SetFocusValues(distanceAway, sprite.Position);
        }
Esempio n. 6
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            PS1      = new FlatRedBall.Sprite();
            PS1.Name = "PS1";
            PS2      = new FlatRedBall.Sprite();
            PS2.Name = "PS2";
            PS3      = new FlatRedBall.Sprite();
            PS3.Name = "PS3";
            PS4      = new FlatRedBall.Sprite();
            PS4.Name = "PS4";
            PS5      = new FlatRedBall.Sprite();
            PS5.Name = "PS5";
            PS6      = new FlatRedBall.Sprite();
            PS6.Name = "PS6";
            PS7      = new FlatRedBall.Sprite();
            PS7.Name = "PS7";
            PS8      = new FlatRedBall.Sprite();
            PS8.Name = "PS8";
            PS9      = new FlatRedBall.Sprite();
            PS9.Name = "PS9";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 7
0
        public Hero(string name, HeroClass heroClass)
        {
            Collect = false;
            Online = TimeSpan.Zero;
            Target = Position;
            AcceptArrows = true;
            zLastPosition = Position;
            Netid = 0;
            Name = name;
            Class = heroClass;
            Position.Z = ZLayer.Npc;
            WalkingSpeed = 10;

            SpriteManager.AddPositionedObject(this);

            Collider = ShapeManager.AddCircle();
            Collider.AttachTo(this, false);
            Collider.Visible = false;

            Sprite = LoadSprite();
            Sprite.AttachTo(this, false);
            Sprite.Resize(4);
            Sprite.AnimationSpeed = 0.1f;            

            Label = TextManager.AddText(name, Globals.Font);
            Label.AttachTo(this, false);
            Label.HorizontalAlignment = HorizontalAlignment.Center;
            Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z);            

            InitStats();
        }
Esempio n. 8
0
 public LayoutableSprite()
 {
     _sprite = new Sprite
     {
         PixelSize = 0.5f,
         UseAnimationRelativePosition = false
     };
 }
Esempio n. 9
0
		private void CustomInitialize()
		{
            SpriteManager.Camera.UsePixelCoordinates(false);
            vacia= SpriteManager.AddSprite("BarraVidaVacia.png");
            llena= SpriteManager.AddSprite("BarraVidaLlena.png");
            llena.PixelSize = .5f;
            vacia.PixelSize = .5f;

		}
Esempio n. 10
0
		private void CustomInitialize()
		{
            SpriteManager.Camera.UsePixelCoordinates(false);
            vacia = SpriteManager.AddSprite("FraccionVacia.png"); 
            fraccion = SpriteManager.AddSprite("FraccionLlena.png");                      
            fraccion.PixelSize = .5f;
            vacia.PixelSize = .5f;

		}
Esempio n. 11
0
        /// <summary>
        /// The reference Sprite is cloned here because some things may change on the Sprite after it is deleted; 
        /// specifically its attachments.
        /// </summary>
        /// <param name="referenceSprite">Reference to the Sprite that is being deleted.</param>
		public DeleteSprite(Sprite referenceSprite)
		{
			 referenceObject = referenceSprite.Clone();

			for(int i = 0; i < referenceSprite.Children.Count; i++)
				((Sprite)referenceObject).Children.AddOneWay(referenceSprite.Children[i]);
			
			
		}
Esempio n. 12
0
        public SplineMover()
        {

            mVisibleRepresentation = SpriteManager.AddSprite(@"Content\Hud\MoveEntireSpline.png");
            SpriteManager.AddToLayer(mVisibleRepresentation, SpriteManager.TopLayer);
            mVisibleRepresentation.AttachTo(this, false);

            SpriteManager.AddPositionedObject(this);
        }
Esempio n. 13
0
        public override void Initialize()
        {
            this.FadeOutImmediately();

            Sprite i2 = this.AddSprite("Content/Story/intro-2.jpg");
            i1 = this.AddSprite("Content/Story/intro-1.jpg");

            base.Initialize();

            this.FadeIn();
        }
Esempio n. 14
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        public override void Initialize(bool addToManagers)
        {
            base.Initialize(addToManagers);

            mObjectHighlight = new ObjectHighlight();
            mObjectHighlight.Color = Color.Orange;
            mEditingHandles = new EditingHandles();

            mRectangle = ShapeManager.AddAxisAlignedRectangle();
            mSprite = SpriteManager.AddSprite("redball.bmp");
            mSprite.X = 5;
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            GridSprite      = new FlatRedBall.Sprite();
            GridSprite.Name = "GridSprite";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 17
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance                     = new FlatRedBall.Sprite();
            SpriteInstance.Name                = "SpriteInstance";
            mAxisAlignedRectangleInstance      = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mAxisAlignedRectangleInstance.Name = "mAxisAlignedRectangleInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 18
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mSpriteInstance      = new FlatRedBall.Sprite();
            mSpriteInstance.Name = "mSpriteInstance";
            mMeleeHitbox         = new FlatRedBall.Math.Geometry.Line();
            mMeleeHitbox.Name    = "mMeleeHitbox";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 19
0
        public Tower3SliceButton(Screen screen, string text, string imagePrefix, int fontSize = 12, int textOffset = 0, string mouseOverPrefix = null, string imageExtension="png")
            : base(screen, text)
        {
            if (string.IsNullOrEmpty(imagePrefix))
            {
                throw new ArgumentOutOfRangeException("Image prefix must be specified. eg. if it's bubble, we look for bubble-left.png, bubble-center.png, and bubble-right.png");
            }

            if (screen is TowerScreen)
            {
                TowerScreen ts = screen as TowerScreen;
                this.Text.BaseText.Scale = fontSize;

                this._centerSprite = ts.AddSprite("Content/Button/" + imagePrefix + "-center." + imageExtension);
                this._leftSprite = ts.AddSprite("Content/Button/" + imagePrefix + "-left." + imageExtension);
                this._rightSprite = ts.AddSprite("Content/Button/" + imagePrefix + "-right." + imageExtension);

                #region button images
                // Length = number of characters, scale = font-size (approximation of pixel size?)
                // Everything is relative to this guy, so set him first.
                this._centerSprite.ScaleX = this.Text.BaseText.DisplayText.Length  * (this.Text.BaseText.Scale / 2.5f);
                this._centerSprite.ScaleY = this.Text.BaseText.Scale + SCALE_PADDING;
                this._centerSprite.Y = textOffset;
                this._centerSprite.AttachTo(this.Text.BaseText, true);

                this._leftSprite.ScaleX = this.Text.BaseText.Scale;
                this._leftSprite.ScaleY = this.Text.BaseText.Scale + SCALE_PADDING;
                this._leftSprite.X -= this._centerSprite.ScaleX + (this._leftSprite.ScaleX / 2);
                this._leftSprite.Y = textOffset;
                this._leftSprite.AttachTo(this.Text.BaseText, true);

                this._rightSprite.ScaleX = this.Text.BaseText.Scale;
                this._rightSprite.ScaleY = this.Text.BaseText.Scale + SCALE_PADDING;
                this._rightSprite.X += this._centerSprite.ScaleX + (this._rightSprite.ScaleX / 2);
                this._rightSprite.Y = textOffset;
                this._rightSprite.AttachTo(this.Text.BaseText, true);
                #endregion

                #region on-click event handlers
                this._centerSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._leftSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._rightSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                #endregion
            }
            else
            {
                // fail.
                throw new InvalidOperationException(TowerUtils.USE_TOWER_FRAMEWORK_MESSAGE);
            }
        }
Esempio n. 20
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            mCollision      = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mCollision.Name = "mCollision";
            Sprite          = new FlatRedBall.Sprite();
            Sprite.Name     = "Sprite";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 21
0
        protected override void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            HandSprite          = new FlatRedBall.Sprite();
            HandSprite.Name     = "HandSprite";
            mGunRectangle       = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mGunRectangle.Name  = "mGunRectangle";
            mFedoraSprite       = new FlatRedBall.Sprite();
            mFedoraSprite.Name  = "mFedoraSprite";

            base.InitializeEntity(addToManagers);
        }
Esempio n. 22
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            PlayerSprite      = new FlatRedBall.Sprite();
            PlayerSprite.Name = "PlayerSprite";
            this.Click       += CallLosePush;
            this.RollOff     += CallLosePush;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 23
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mAxisAlignedRectangleInstance      = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mAxisAlignedRectangleInstance.Name = "mAxisAlignedRectangleInstance";
            mBallCatchArea      = new FlatRedBall.Math.Geometry.Circle();
            mBallCatchArea.Name = "mBallCatchArea";
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";

            // this provides default controls for the platformer using either keyboad or 360. Can be overridden in custom code:
            this.InitializeInput();

            BeforeGroundMovementSet += (newValue) =>
            {
                if (mGroundMovement != null && mGroundMovement == mValuesJumpedWith)
                {
                    mValuesJumpedWith = newValue;
                }
            };

            BeforeAirMovementSet += (newValue) =>
            {
                if (mAirMovement != null && mAirMovement == mValuesJumpedWith)
                {
                    mValuesJumpedWith = newValue;
                }
            };

            BeforeAfterDoubleJumpSet += (newValue) =>
            {
                if (mAfterDoubleJump != null && mAfterDoubleJump == mValuesJumpedWith)
                {
                    mValuesJumpedWith = newValue;
                }
            };

            AfterGroundMovementSet  += (not, used) => UpdateCurrentMovement();
            AfterAirMovementSet     += (not, used) => UpdateCurrentMovement();
            AfterAfterDoubleJumpSet += (not, used) => UpdateCurrentMovement();


            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mCollisionCircle            = new FlatRedBall.Math.Geometry.Circle();
            mCollisionCircle.Name       = "mCollisionCircle";
            mKickIndicatorInstance      = new Soccer.Entities.KickIndicator(ContentManagerName, false);
            mKickIndicatorInstance.Name = "mKickIndicatorInstance";
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected override void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance                     = new FlatRedBall.Sprite();
            SpriteInstance.Name                = "SpriteInstance";
            mAxisAlignedRectangleInstance      = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mAxisAlignedRectangleInstance.Name = "mAxisAlignedRectangleInstance";
            LightSpriteInstance                = new FlatRedBall.Sprite();
            LightSpriteInstance.Name           = "LightSpriteInstance";
            AimSpriteInstance                  = new FlatRedBall.Sprite();
            AimSpriteInstance.Name             = "AimSpriteInstance";
            PivotPoint      = new FlatRedBall.PositionedObject();
            PivotPoint.Name = "PivotPoint";

            base.InitializeEntity(addToManagers);
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance           = new FlatRedBall.Sprite();
            SpriteInstance.Name      = "SpriteInstance";
            mCircleInstance          = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name     = "mCircleInstance";
            mRangePreviewSprite      = new FlatRedBall.Sprite();
            mRangePreviewSprite.Name = "mRangePreviewSprite";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            BarSprite             = new FlatRedBall.Sprite();
            BarSprite.Name        = "BarSprite";
            FrameSprite           = new FlatRedBall.Sprite();
            FrameSprite.Name      = "FrameSprite";
            BackgroundSprite      = new FlatRedBall.Sprite();
            BackgroundSprite.Name = "BackgroundSprite";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 28
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            TextInstance        = new FlatRedBall.Graphics.Text();
            TextInstance.Name   = "TextInstance";
            this.Click         += CallLosePush;
            this.RollOff       += CallLosePush;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 29
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            ButtonLeave         = new Pirates.Entities.UI.Button(ContentManagerName, false);
            ButtonLeave.Name    = "ButtonLeave";
            gumIdb = new FlatRedBall.Gum.GumIdb();


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Esempio n. 30
0
        public CommandDisplay()
        {
            mLayer = SpriteManager.AddLayer();

            SpriteManager.AddPositionedObject(this);

            Texture2D texture = FlatRedBallServices.Load<Texture2D>(@"Assets\UI\LinkIcon.png", 
                "Global");

            mCreateLink = SpriteManager.AddSprite(texture, mLayer);

            mCreateLink.ScaleX = mCreateLink.ScaleY = .5f;
            mCreateLink.AttachTo(this, false);
            mCreateLink.RelativeX = -1.5f;
            mCreateLink.RelativeY = 1.5f;

        }
Esempio n. 31
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            TextInstance        = new FlatRedBall.Graphics.Text();
            TextInstance.Name   = "TextInstance";
            mHitbox             = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mHitbox.Name        = "mHitbox";
            WeaponInstance      = new Pirates.Entities.WeaponEntity(ContentManagerName, false);
            WeaponInstance.Name = "WeaponInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance            = new FlatRedBall.Sprite();
            SpriteInstance.Name       = "SpriteInstance";
            mCircleInstance           = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name      = "mCircleInstance";
            BulletShadow              = new FlatRedBall.Sprite();
            BulletShadow.Name         = "BulletShadow";
            MissileTrailInstance      = new GreasyPlatypusSlapper.Entities.Effects.MissileTrail(ContentManagerName, false);
            MissileTrailInstance.Name = "MissileTrailInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 33
0
        /// <summary>
        /// Base Screen constructor requires this. Get it done,
        /// so that we don't have to to add this to all screens.
        /// </summary>
        public TowerScreen()
            : base(typeof(TowerScreen).FullName)
        {
            Camera camera = SpriteManager.Camera;

            this._fadeOut = this.AddSprite("Content/1x1.png");
            this._fadeOut.ScaleX = camera.Width / 2;
            this._fadeOut.ScaleY = camera.Height / 2;
            this._fadeOut.Alpha = 0;

            // Make it black!
            this._fadeOut.Red = 0;
            this._fadeOut.Green = 0;
            this._fadeOut.Blue = 0;
            this._fadeOut.ColorOperation = ColorOperation.Color;

            this.GetTopZValueAndMoveFadeToTop(); // puts blackout on top
        }
Esempio n. 34
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            BoatSpriteInstance      = new FlatRedBall.Sprite();
            BoatSpriteInstance.Name = "BoatSpriteInstance";
            mHitbox                   = new FlatRedBall.Math.Geometry.Polygon();
            mHitbox.Name              = "mHitbox";
            AnchorSpriteInstance      = new FlatRedBall.Sprite();
            AnchorSpriteInstance.Name = "AnchorSpriteInstance";
            CannonballList            = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Cannonball>();
            CannonballList.Name       = "CannonballList";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            if (!FlatRedBallServices.IsLoaded <FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName))
            {
            }
            SceneFile    = FlatRedBallServices.Load <FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName);
            SpriteObject = SceneFile.Sprites.FindByName("frblogo5121");

            this.NextScreen = typeof(LudumDare29.Screens.MenuScreen).FullName;

            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            CcgLogo             = new FlatRedBall.Sprite();
            CcgLogo.Name        = "CcgLogo";
            CreatedByLabel      = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            CreatedByLabel.Name = "CreatedByLabel";
            CCGLabel            = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            CCGLabel.Name       = "CCGLabel";

            this.NextScreen = typeof(FrbTicTacToe.Screens.TitleMenu).FullName;

            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Esempio n. 37
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance       = new FlatRedBall.Sprite();
            SpriteInstance.Name  = "SpriteInstance";
            mCircleInstance      = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name = "mCircleInstance";
            TurretInstance       = new GreasyPlatypusSlapper.Entities.Turret(ContentManagerName, false);
            TurretInstance.Name  = "TurretInstance";
            TankShadow           = new FlatRedBall.Sprite();
            TankShadow.Name      = "TankShadow";
            SmokeInstance        = new GreasyPlatypusSlapper.Entities.Effects.Smoke(ContentManagerName, false);
            SmokeInstance.Name   = "SmokeInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 38
0
        public SplineCrawler(Spline splineToMoveAlong)
        {
            ConstantVelocityValue = 3;

            mSpline = splineToMoveAlong;

            mVisibleRepresentation = SpriteManager.AddSprite("redball.bmp");
            mVisibleRepresentation.AttachTo(this, false);
            mVisibleRepresentation.ColorOperation = FlatRedBall.Graphics.ColorOperation.Add;
            mVisibleRepresentation.Blue = .5f;

            SpriteManager.AddPositionedObject(this);

            this.Position = mSpline.GetPositionAtTime(0);

            const float scaleMultiplier = 20; // so it pulses big for a sec
            mVisibleRepresentation.ScaleX = mVisibleRepresentation.ScaleY = 
                scaleMultiplier / SpriteManager.Camera.PixelsPerUnitAt(this.Z);

        }
Esempio n. 39
0
        public static void RecordInstructions(InstructionList listToRecordTo, double timeToExecute, 
            List<string> membersToIgnore, Sprite spriteToRecord)
        {
            foreach (string member in EditorData.CurrentSpriteMembersWatching)
            {
                if (membersToIgnore.Contains(member) == false)
                {
                    Type memberType = InstructionManager.GetTypeForMember(mSpriteType, member);

                    Type genericType = typeof(Instruction<,>).MakeGenericType(
                        mSpriteType, memberType);
                    object value = FlatRedBall.Instructions.Reflection.LateBinder<Sprite>.Instance[spriteToRecord, member];

                    Instruction instruction = Activator.CreateInstance(genericType,
                        spriteToRecord, member, value, timeToExecute) as Instruction;

                    listToRecordTo.Add(instruction);
                }
            }
        }
Esempio n. 40
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance       = new FlatRedBall.Sprite();
            SpriteInstance.Name  = "SpriteInstance";
            mCircleInstance      = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name = "mCircleInstance";
            InitializeInput();
            if (TopDownValues?.Count > 0)
            {
                mCurrentMovement = TopDownValues.Values.FirstOrDefault();
            }
            PossibleDirections     = PossibleDirections.FourWay;
            mTopDownAnimationLayer = new TopDown.DirectionBasedAnimationLayer();
            mTopDownAnimationLayer.TopDownEntity = this;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            VictoryTextLabel      = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            VictoryTextLabel.Name = "VictoryTextLabel";
            PlayAgainText         = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            PlayAgainText.Name    = "PlayAgainText";
            NoButton              = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            NoButton.Name         = "NoButton";
            YesButton             = new FrbTicTacToe.Entities.Label(ContentManagerName, false);
            YesButton.Name        = "YesButton";
            BackgroundSprite      = new FlatRedBall.Sprite();
            BackgroundSprite.Name = "BackgroundSprite";
            this.Click           += CallLosePush;
            this.RollOff         += CallLosePush;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 42
0
        public void InitializeToScreen(TowerScreen screen)
        {
            _atomNameText = screen.AddText(string.Empty);
            _atomValenceText = screen.AddText(string.Empty);
            _atomElectronegativityText = screen.AddText(string.Empty);
            _atomDescription = screen.AddText(string.Empty);
            _background = screen.AddSprite("Content/message-panel.png");

            _atomNameText.Y = 70;
            _atomValenceText.Y = _atomNameText.Y;
            _atomElectronegativityText.Y = _atomNameText.Y;
            _atomDescription.Y = _atomNameText.Y - 20;

            _atomNameText.Scale = 18;
            _atomValenceText.Scale = 18;
            _atomElectronegativityText.Scale = 18;
            _atomDescription.Scale = 18;

            _atomNameText.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Left;
            _atomNameText.X = -175;

            _atomDescription.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Left;
            _atomDescription.X = _atomNameText.X;
            _atomDescription.VerticalAlignment = FlatRedBall.Graphics.VerticalAlignment.Top;

            _atomElectronegativityText.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Right;
            _atomElectronegativityText.X = (this._background.Texture.Width / 2) - 25;

            // Climb on top of everything
            this._background.Z = 1;
            this._atomDescription.Z = 2;
            this._atomElectronegativityText.Z = 2;
            this._atomNameText.Z = 2;
            this._atomValenceText.Z = 2;

            this.Hide();
        }
Esempio n. 43
0
        protected bool Collect; //used to signal running events that this window has been destroyed

        public Window(Window owner = null, bool modal = false, string sprite = "")
        {            
            if (owner != null && modal)
                throw new ArgumentException("Child cannot be modal");
            Collect = false;
            Immovable = false;
            zEventEscape = null;
            zModal = modal;
            Name = string.Empty;
            zOrigin = new Vector2(0, 0);
            if (sprite == "")
                zSprite = SpriteManager.AddSprite(Path.Make(Path.Misc, "pixel.bmp"));
            else
                zSprite = SpriteManager.AddSprite(sprite);
            zSprite.ColorOperation = ColorOperation.ColorTextureAlpha;
            Color = Color.White;
            zVisible = true;
            OnClick = delegate () { };
            Hover = delegate () { };
            HoverMousedown = delegate () { };
            MouseLeave = delegate () { };
            MouseEnter = delegate () { };
            zParent = owner;
            zChildren = new List<Window>();
            zText = TextManager.AddText(string.Empty, Globals.Font);
            zText.ColorOperation = ColorOperation.ColorTextureAlpha;
            zText.AttachTo(zSprite, false);
            Size = new Vector2(1, 1);
            if (owner == null)
                InitializeAsTopLevel();
            else
                InitializeAsChild();
            SpriteManager.AddToLayer(zSprite, zLayer);
            TextManager.AddToLayer(zText, zLayer);
            zSprite.AttachTo(Camera.Main, true);
        }
Esempio n. 44
0
        public TowerMessagePanel(Screen screen, string backgroundSprite, string text)
        {
            if (screen is TowerScreen) {
                // Automatically managed and removed
                TowerScreen t = screen as TowerScreen;
                this._background = t.AddSprite(backgroundSprite);
                this._text = t.AddText(string.Empty);
            } else {
                // User must manage them since we can't touch mTexts and mSprites.
                throw new ArgumentException(TowerUtils.USE_TOWER_FRAMEWORK_MESSAGE);
            }

            this._background.PixelSize = 0.5f;
            // +4 to offset so we don't TOUCH the border

            this._text.Scale = 18;
            this.DisplayText = text;

            this._background.CustomBehavior += new SpriteCustomBehavior(_background_CustomBehavior);

            // We need to be really high up.
            this._background.Z = 1;
            this._text.Z = this._background.Z + 1;
        }
Esempio n. 45
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            TheSpriteInstance            = new FlatRedBall.Sprite();
            TheSpriteInstance.Name       = "TheSpriteInstance";
            ASpriteInstance              = new FlatRedBall.Sprite();
            ASpriteInstance.Name         = "ASpriteInstance";
            BbatoirSpriteInstance        = new FlatRedBall.Sprite();
            BbatoirSpriteInstance.Name   = "BbatoirSpriteInstance";
            ISpriteInstance              = new FlatRedBall.Sprite();
            ISpriteInstance.Name         = "ISpriteInstance";
            NtergradeSpriteInstance      = new FlatRedBall.Sprite();
            NtergradeSpriteInstance.Name = "NtergradeSpriteInstance";
            MainMenuGumRuntime           = MainMenuGum.GetGraphicalUiElementByName("this") as AbbatoirIntergrade.GumRuntimes.MainMenuGumRuntime;
            LeftEye = MainMenuGum.GetGraphicalUiElementByName("LeftEye") as AbbatoirIntergrade.GumRuntimes.unique.MainMenuEyeRuntime;


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Esempio n. 46
0
        public Tower9SliceButton(Screen screen, string text)
            : base(screen, text)
        {
            //Screen screen = ScreenManager.CurrentScreen;
            if (screen is TowerScreen)
            {
                TowerScreen ts = screen as TowerScreen;
                this._bottomCenterSprite = ts.AddSprite("Content/Button/bottom-center.png");
                this._bottomLeftSprite = ts.AddSprite("Content/Button/bottom-left.png");
                this._bottomRightSprite = ts.AddSprite("Content/Button/bottom-right.png");
                this._middleCenterSprite = ts.AddSprite("Content/Button/middle-center.png");
                this._middleLeftSprite = ts.AddSprite("Content/Button/middle-left.png");
                this._middleRightSprite = ts.AddSprite("Content/Button/middle-right.png");
                this._topCenterSprite = ts.AddSprite("Content/Button/top-center.png");
                this._topLeftSprite = ts.AddSprite("Content/Button/top-left.png");
                this._topRightSprite = ts.AddSprite("Content/Button/top-right.png");

                // Validate LHS sprites are the same width
                if (this._topLeftSprite.Texture.Width != this._middleLeftSprite.Texture.Width ||
                    this._middleLeftSprite.Texture.Width != this._bottomLeftSprite.Texture.Width)
                {
                    throw new ArgumentException(string.Format("Top-left, middle-left, and bottom-left images need to be the same width; currently, they're {0}px, {1}px, and {2}px respectively.", this._topLeftSprite.Texture.Width, this._middleLeftSprite.Texture.Width, this._bottomLeftSprite.Texture.Width));
                }

                // Validate RHS sprites are the same width
                if (this._topRightSprite.Texture.Width != this._middleRightSprite.Texture.Width ||
                    this._middleRightSprite.Texture.Width != this._bottomRightSprite.Texture.Width)
                {
                    throw new ArgumentException(string.Format("Top-right, middle-right, and bottom-right images need to be the same width; currently, they're {0}px, {1}px, and {2}px respectively.", this._topRightSprite.Texture.Width, this._middleRightSprite.Texture.Width, this._bottomRightSprite.Texture.Width));
                }

                #region button images
                // Length = number of characters, scale = font-size (approximation of pixel size?)
                // Everything is relative to this guy, so set him first.
                this._middleCenterSprite.ScaleX = this.Text.BaseText.DisplayText.Length * (this.Text.BaseText.Scale / 2);
                this._middleCenterSprite.ScaleY = this.Text.BaseText.Scale;
                this._middleCenterSprite.AttachTo(this.Text.BaseText, true);

                #region top images
                this._topLeftSprite.X -= this._middleCenterSprite.ScaleX + (this._topLeftSprite.Texture.Width / 2);
                this._topLeftSprite.Y += this._middleCenterSprite.Texture.Height + (this._topLeftSprite.Texture.Height * 1.5f);
                this._topLeftSprite.AttachTo(this.Text.BaseText, true);

                this._topCenterSprite.ScaleX = this._middleCenterSprite.ScaleX;
                this._topCenterSprite.X = this._topLeftSprite.X + (this._topLeftSprite.Texture.Width / 2) + this._topCenterSprite.ScaleX;
                this._topCenterSprite.Y = this._topLeftSprite.Y;
                this._topCenterSprite.AttachTo(this._topLeftSprite, true);

                this._topRightSprite.X += this._middleCenterSprite.ScaleX + (this._topRightSprite.Texture.Width / 2);
                this._topRightSprite.Y += this._middleCenterSprite.Texture.Height + (this._topRightSprite.Texture.Height * 1.5f);
                this._topRightSprite.AttachTo(this.Text.BaseText, true);
                #endregion

                #region bottom images
                this._bottomLeftSprite.X -= this._middleCenterSprite.ScaleX + (this._bottomLeftSprite.Texture.Width / 2);
                this._bottomLeftSprite.Y -= this._middleCenterSprite.Texture.Height + (this._bottomLeftSprite.Texture.Height * 1.5f);
                this._bottomLeftSprite.AttachTo(this.Text.BaseText, true);

                this._bottomCenterSprite.ScaleX = this._middleCenterSprite.ScaleX;
                this._bottomCenterSprite.X = this._bottomLeftSprite.X + (this._bottomLeftSprite.Texture.Width / 2) + this._bottomCenterSprite.ScaleX;
                this._bottomCenterSprite.Y = this._bottomLeftSprite.Y;
                this._bottomCenterSprite.AttachTo(this._bottomLeftSprite, true);

                this._bottomRightSprite.X += this._middleCenterSprite.ScaleX + (this._bottomRightSprite.Texture.Width / 2);
                this._bottomRightSprite.Y -= this._middleCenterSprite.Texture.Height + (this._bottomRightSprite.Texture.Height * 1.5f);
                this._bottomRightSprite.AttachTo(this.Text.BaseText, true);
                #endregion

                #region middle images
                this._middleLeftSprite.X = this._topLeftSprite.X;
                this._middleLeftSprite.ScaleY = this._middleCenterSprite.ScaleY;
                this._middleLeftSprite.AttachTo(this._topLeftSprite, true);

                this._middleRightSprite.X = this._topRightSprite.X;
                this._middleRightSprite.ScaleY = this._middleCenterSprite.ScaleY;
                this._middleRightSprite.AttachTo(this._topRightSprite, true);
                #endregion

                #region on-click event handlers
                this._bottomCenterSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._bottomLeftSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._bottomRightSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._middleCenterSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._middleLeftSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._middleRightSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._topCenterSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._topLeftSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                this._topRightSprite.CustomBehavior += new SpriteCustomBehavior(imageClicked_CustomBehavior);
                #endregion

                #endregion
            }
            else
            {
                // fail.
                throw new InvalidOperationException(TowerUtils.USE_TOWER_FRAMEWORK_MESSAGE);
            }
        }
Esempio n. 47
0
        public void InitializeSprite(Texture2D texture, int row, int column)
        {
            this.SpriteSheetRow = row;
            this.SpriteSheetColumn = column;
            SpriteInstance = new Sprite();
            this.X = column * (int)MappingEnum.TileWidth;
            this.Y = -(row * (int)MappingEnum.TileHeight);

            SpriteInstance.Texture = texture;
            SpriteInstance.PixelSize = 0.5f;
            SpriteInstance.TopTexturePixel = row * (int)MappingEnum.TileHeight;
            SpriteInstance.LeftTexturePixel = column * (int)MappingEnum.TileWidth;
            SpriteInstance.BottomTexturePixel = (row + 1) * (int)MappingEnum.TileHeight;
            SpriteInstance.RightTexturePixel = (column + 1) * (int)MappingEnum.TileWidth;

            SpriteManager.AddSprite(SpriteInstance);
            SpriteInstance.AttachTo(this, false);
        }
Esempio n. 48
0
        public bool IsSpriteInView(Sprite sprite, bool relativeToCamera)
        {
            switch (CameraCullMode)
            {

                case CameraCullMode.UnrotatedDownZ:
                    {
                        mLongestDimension = (float)(System.Math.Max(sprite.ScaleX, sprite.ScaleY) * 1.42f);


                        if (mOrthogonal)
                        {
                            if (relativeToCamera)
                            {
                                if (System.Math.Abs(sprite.X) - mLongestDimension > mOrthogonalWidth)
                                {
                                    return false;
                                }
                                if (System.Math.Abs(sprite.Y) - mLongestDimension > mOrthogonalHeight)
                                {
                                    return false;
                                }
                            }
                            else
                            {
                                if (System.Math.Abs(X - sprite.X) - mLongestDimension > mOrthogonalWidth)
                                {
                                    return false;
                                }
                                if (System.Math.Abs(Y - sprite.Y) - mLongestDimension > mOrthogonalHeight)
                                {
                                    return false;
                                }
                            }
                        }
                        else // if (camera.cull)
                        {
                            // Multiply by 1.5 to increase the range in case the Camera is rotated
                            if (relativeToCamera)
                            {
#if FRB_MDX
                                mDistanceFromCamera = (sprite.Z) / 100.0f;

#else
                                mDistanceFromCamera = (-sprite.Z) / 100.0f;
#endif
                                if (System.Math.Abs(sprite.X) - mLongestDimension > mXEdge * 1.5f * mDistanceFromCamera)
                                {
                                    return false;
                                }
                                if (System.Math.Abs(sprite.Y) - mLongestDimension > mYEdge * 1.5f * mDistanceFromCamera)
                                {
                                    return false;
                                }
                            }
                            else
                            {
#if FRB_MDX
                                mDistanceFromCamera = (sprite.Z - Z) / 100.0f;

#else
                                mDistanceFromCamera = (Z - sprite.Z) / 100.0f;
#endif
                                if (System.Math.Abs(X - sprite.X) - mLongestDimension > mXEdge * 1.5f * mDistanceFromCamera)
                                {
                                    return false;
                                }
                                if (System.Math.Abs(Y - sprite.Y) - mLongestDimension > mYEdge * 1.5f * mDistanceFromCamera)
                                {
                                    return false;
                                }
                            }
                        }
                    }
                    return true;
                case CameraCullMode.None:
                    return true;
            }
            return true;

        }
Esempio n. 49
0
        public override void Initialize(bool addToManagers)
        {
			// Generated Initialize
			LoadStaticContent(ContentManagerName);
			if (!FlatRedBall.FlatRedBallServices.IsLoaded<FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName))
			{
			}
			SceneFile = FlatRedBall.FlatRedBallServices.Load<FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName);
			SpriteObject = SceneFile.Sprites.FindByName("frblogo5121");
			
			this.NextScreen = typeof(TesisEconoFight.Screens.MenuPrincipal).FullName;
			
			PostInitialize();
			base.Initialize(addToManagers);
			if (addToManagers)
			{
				AddToManagers();
			}

        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            Tread1      = new FlatRedBall.Sprite();
            Tread1.Name = "Tread1";
            Tread2      = new FlatRedBall.Sprite();
            Tread2.Name = "Tread2";

            PostInitialize();
            if (Tread1.Parent == null)
            {
                Tread1XReset = Tread1.X;
            }
            else
            {
                Tread1XReset = Tread1.RelativeX;
            }
            if (Tread1.Parent == null)
            {
                Tread1YReset = Tread1.Y;
            }
            else
            {
                Tread1YReset = Tread1.RelativeY;
            }
            if (Tread1.Parent == null)
            {
                Tread1ZReset = Tread1.Z;
            }
            else
            {
                Tread1ZReset = Tread1.RelativeZ;
            }
            if (Tread1.Parent == null)
            {
                Tread1XVelocityReset = Tread1.XVelocity;
            }
            else
            {
                Tread1XVelocityReset = Tread1.RelativeXVelocity;
            }
            if (Tread1.Parent == null)
            {
                Tread1YVelocityReset = Tread1.YVelocity;
            }
            else
            {
                Tread1YVelocityReset = Tread1.RelativeYVelocity;
            }
            if (Tread1.Parent == null)
            {
                Tread1ZVelocityReset = Tread1.ZVelocity;
            }
            else
            {
                Tread1ZVelocityReset = Tread1.RelativeZVelocity;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationXReset = Tread1.RotationX;
            }
            else
            {
                Tread1RotationXReset = Tread1.RelativeRotationX;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationYReset = Tread1.RotationY;
            }
            else
            {
                Tread1RotationYReset = Tread1.RelativeRotationY;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationZReset = Tread1.RotationZ;
            }
            else
            {
                Tread1RotationZReset = Tread1.RelativeRotationZ;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationXVelocityReset = Tread1.RotationXVelocity;
            }
            else
            {
                Tread1RotationXVelocityReset = Tread1.RelativeRotationXVelocity;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationYVelocityReset = Tread1.RotationYVelocity;
            }
            else
            {
                Tread1RotationYVelocityReset = Tread1.RelativeRotationYVelocity;
            }
            if (Tread1.Parent == null)
            {
                Tread1RotationZVelocityReset = Tread1.RotationZVelocity;
            }
            else
            {
                Tread1RotationZVelocityReset = Tread1.RelativeRotationZVelocity;
            }
            Tread1AlphaReset     = Tread1.Alpha;
            Tread1AlphaRateReset = Tread1.AlphaRate;
            if (Tread2.Parent == null)
            {
                Tread2XReset = Tread2.X;
            }
            else
            {
                Tread2XReset = Tread2.RelativeX;
            }
            if (Tread2.Parent == null)
            {
                Tread2YReset = Tread2.Y;
            }
            else
            {
                Tread2YReset = Tread2.RelativeY;
            }
            if (Tread2.Parent == null)
            {
                Tread2ZReset = Tread2.Z;
            }
            else
            {
                Tread2ZReset = Tread2.RelativeZ;
            }
            if (Tread2.Parent == null)
            {
                Tread2XVelocityReset = Tread2.XVelocity;
            }
            else
            {
                Tread2XVelocityReset = Tread2.RelativeXVelocity;
            }
            if (Tread2.Parent == null)
            {
                Tread2YVelocityReset = Tread2.YVelocity;
            }
            else
            {
                Tread2YVelocityReset = Tread2.RelativeYVelocity;
            }
            if (Tread2.Parent == null)
            {
                Tread2ZVelocityReset = Tread2.ZVelocity;
            }
            else
            {
                Tread2ZVelocityReset = Tread2.RelativeZVelocity;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationXReset = Tread2.RotationX;
            }
            else
            {
                Tread2RotationXReset = Tread2.RelativeRotationX;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationYReset = Tread2.RotationY;
            }
            else
            {
                Tread2RotationYReset = Tread2.RelativeRotationY;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationZReset = Tread2.RotationZ;
            }
            else
            {
                Tread2RotationZReset = Tread2.RelativeRotationZ;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationXVelocityReset = Tread2.RotationXVelocity;
            }
            else
            {
                Tread2RotationXVelocityReset = Tread2.RelativeRotationXVelocity;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationYVelocityReset = Tread2.RotationYVelocity;
            }
            else
            {
                Tread2RotationYVelocityReset = Tread2.RelativeRotationYVelocity;
            }
            if (Tread2.Parent == null)
            {
                Tread2RotationZVelocityReset = Tread2.RotationZVelocity;
            }
            else
            {
                Tread2RotationZVelocityReset = Tread2.RelativeRotationZVelocity;
            }
            Tread2AlphaReset     = Tread2.Alpha;
            Tread2AlphaRateReset = Tread2.AlphaRate;
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 51
0
        private void saveButtonClick(Window callingWindow)
        {
            // If a user thinks he's funny and selects AllNotJoint for BodySprites
            // and AllNotBodySprites for Joints, let the user know he has to
            // specify some criteria.
            if (this.bodySpriteSelectionMethod.Text == "All Not Joint" &&
                this.jointSpriteSelectionMethod.Text == "All Not Body")
            {
                GuiManager.ShowMessageBox(
                    "Cannot select All Not Body for Joint Selection when " +
                    "All Not Joint is selected for Body Sprite Selection.  " +
                    "Change one of the criteria and try to save again.", "Selection Error");
                return;

            }



            double error = 0;
            SpriteList possibleSprites = new SpriteList();

            if (this.sceneOrGroup.Text == "Entire Scene")
            {
                possibleSprites = GameData.Scene.Sprites;
            }
            else if (GameData.EditorLogic.CurrentSprites.Count != 0)
            {
                ((Sprite)GameData.EditorLogic.CurrentSprites[0].TopParent).GetAllDescendantsOneWay(possibleSprites);
            }

            #region Get rid of the Axes from the possibleSprites

            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.zAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.zAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xRot))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xRot);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yRot))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yRot);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xScale))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xScale);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yScale))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yScale);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.origin))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.origin);
            }
            #endregion

            if (this.bodySpriteSelectionMethod.Text == "Name Includes")
            {
                this.bodySprites = possibleSprites.FindSpritesWithNameContaining(this.bodyNameToInclude.Text);
            }
            else if (this.bodySpriteSelectionMethod.Text == "By Texture")
            {
                this.bodySprites = possibleSprites.FindSpritesWithTexture(
                    FlatRedBallServices.Load<Texture2D>(this.bodyAvailableTextures.Text, GameData.SceneContentManager));
            }
            else if (this.bodySpriteSelectionMethod.Text == "All")
            {
                this.bodySprites = possibleSprites;
            }

            if (this.jointSpriteSelectionMethod.Text == "Name Includes")
            {
                this.joints = possibleSprites.FindSpritesWithNameContaining(this.jointNameToInclude.Text);
            }
            else if (this.jointSpriteSelectionMethod.Text == "By Texture")
            {
                this.joints = possibleSprites.FindSpritesWithTexture(
                    FlatRedBallServices.Load<Texture2D>(this.jointAvailableTextures.Text, GameData.SceneContentManager));
            }
            else if (this.jointSpriteSelectionMethod.Text == "All")
            {
                this.joints = possibleSprites;
            }

            try
            {
                if (bodySpriteSelectionMethod == null) System.Windows.Forms.MessageBox.Show("a");

                if (this.bodySpriteSelectionMethod.Text == "All Not Joint")
                {
                    this.bodySprites = new SpriteList();

                    if (possibleSprites == null) System.Windows.Forms.MessageBox.Show("b");


                    foreach (Sprite s in possibleSprites)
                    {
                        if (this == null) System.Windows.Forms.MessageBox.Show("c");
                        if (this.joints == null) System.Windows.Forms.MessageBox.Show("d");
                        if (this.bodySprites == null) System.Windows.Forms.MessageBox.Show("e");



                        if (!this.joints.Contains(s))
                        {
                            this.bodySprites.Add(s);
                        }
                    }
                }
            }
            catch { error = 3.3; }
                if (this.jointSpriteSelectionMethod.Text == "All Not Body")
                {
                    this.joints = new SpriteList();
                    foreach (Sprite s in possibleSprites)
                    {
                        if (!this.bodySprites.Contains(s))
                        {
                            this.joints.Add(s);
                        }
                    }
                }

                if (this.rootSpriteComboBox.Text != "<No Root>")
                {
                    this.root = possibleSprites.FindByName(this.rootSpriteComboBox.Text);
                }
                else
                {
                    this.root = null;
                }




            FileButtonWindow.spriteRigOptionsOK(this);
            this.Visible = false;

        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            XBoxStartButton = StartButtonScene.Sprites.FindByName("xbox360_button_start1").Clone();
            this.Click += OnClick;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 53
0
        public ListBoxBase(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mTexts = new PositionedObjectList<Text>();
            mHighlight = new Sprite();
            mHighlight.Z = AbsoluteWorldUnitZ - .0001f *
                FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mScrollBar = new ScrollBar(guiSkin, cursor);
            AddWindow(mScrollBar);
            Initialize();
            mScrollBar.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;


            // Even though the base constructor calls SetSkin, the mTexts are not
            // created yet so their font is never set.  This set the fonts once again.

            mHighlightBar = new SpriteFrame(
                guiSkin.WindowSkin.Texture, guiSkin.WindowSkin.BorderSides);
            SpriteManager.AddSpriteFrame(mHighlightBar);
            mHighlightBar.AttachTo(SpriteFrame, false);
            mHighlightBar.RelativeZ = -HighlightBarOffset * Math.MathFunctions.ForwardVector3.Z;
            mHighlightBar.Visible = false;

            SetSkin(guiSkin);
        }
Esempio n. 54
0
        public ListBoxBase(Cursor cursor)
            : base(cursor)
        {
            mHighlight = new Sprite();
            mHighlight.Z = AbsoluteWorldUnitZ - .0001f *
                FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mScrollBar = new ScrollBar(mCursor);
            AddWindow(mScrollBar);

            Initialize();

        }
Esempio n. 55
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance           = new FlatRedBall.Sprite();
            SpriteInstance.Name      = "SpriteInstance";
            LightOrShadowSprite      = new FlatRedBall.Sprite();
            LightOrShadowSprite.Name = "LightOrShadowSprite";
            mCircleInstance          = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name     = "mCircleInstance";
            // Not instantiating for AnimationChain AnimationChainInstance in Entities\BaseEntities\BasePlayerProjectile because properties on the object prevent it

            PostInitialize();
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXReset = SpriteInstance.X;
            }
            else
            {
                SpriteInstanceXReset = SpriteInstance.RelativeX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYReset = SpriteInstance.Y;
            }
            else
            {
                SpriteInstanceYReset = SpriteInstance.RelativeY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZReset = SpriteInstance.Z;
            }
            else
            {
                SpriteInstanceZReset = SpriteInstance.RelativeZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXVelocityReset = SpriteInstance.XVelocity;
            }
            else
            {
                SpriteInstanceXVelocityReset = SpriteInstance.RelativeXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYVelocityReset = SpriteInstance.YVelocity;
            }
            else
            {
                SpriteInstanceYVelocityReset = SpriteInstance.RelativeYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZVelocityReset = SpriteInstance.ZVelocity;
            }
            else
            {
                SpriteInstanceZVelocityReset = SpriteInstance.RelativeZVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXReset = SpriteInstance.RotationX;
            }
            else
            {
                SpriteInstanceRotationXReset = SpriteInstance.RelativeRotationX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYReset = SpriteInstance.RotationY;
            }
            else
            {
                SpriteInstanceRotationYReset = SpriteInstance.RelativeRotationY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZReset = SpriteInstance.RotationZ;
            }
            else
            {
                SpriteInstanceRotationZReset = SpriteInstance.RelativeRotationZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RotationXVelocity;
            }
            else
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RelativeRotationXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RotationYVelocity;
            }
            else
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RelativeRotationYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RotationZVelocity;
            }
            else
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RelativeRotationZVelocity;
            }
            SpriteInstanceAlphaReset     = SpriteInstance.Alpha;
            SpriteInstanceAlphaRateReset = SpriteInstance.AlphaRate;
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteXReset = LightOrShadowSprite.X;
            }
            else
            {
                LightOrShadowSpriteXReset = LightOrShadowSprite.RelativeX;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteYReset = LightOrShadowSprite.Y;
            }
            else
            {
                LightOrShadowSpriteYReset = LightOrShadowSprite.RelativeY;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteZReset = LightOrShadowSprite.Z;
            }
            else
            {
                LightOrShadowSpriteZReset = LightOrShadowSprite.RelativeZ;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteXVelocityReset = LightOrShadowSprite.XVelocity;
            }
            else
            {
                LightOrShadowSpriteXVelocityReset = LightOrShadowSprite.RelativeXVelocity;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteYVelocityReset = LightOrShadowSprite.YVelocity;
            }
            else
            {
                LightOrShadowSpriteYVelocityReset = LightOrShadowSprite.RelativeYVelocity;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteZVelocityReset = LightOrShadowSprite.ZVelocity;
            }
            else
            {
                LightOrShadowSpriteZVelocityReset = LightOrShadowSprite.RelativeZVelocity;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationXReset = LightOrShadowSprite.RotationX;
            }
            else
            {
                LightOrShadowSpriteRotationXReset = LightOrShadowSprite.RelativeRotationX;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationYReset = LightOrShadowSprite.RotationY;
            }
            else
            {
                LightOrShadowSpriteRotationYReset = LightOrShadowSprite.RelativeRotationY;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationZReset = LightOrShadowSprite.RotationZ;
            }
            else
            {
                LightOrShadowSpriteRotationZReset = LightOrShadowSprite.RelativeRotationZ;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationXVelocityReset = LightOrShadowSprite.RotationXVelocity;
            }
            else
            {
                LightOrShadowSpriteRotationXVelocityReset = LightOrShadowSprite.RelativeRotationXVelocity;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationYVelocityReset = LightOrShadowSprite.RotationYVelocity;
            }
            else
            {
                LightOrShadowSpriteRotationYVelocityReset = LightOrShadowSprite.RelativeRotationYVelocity;
            }
            if (LightOrShadowSprite.Parent == null)
            {
                LightOrShadowSpriteRotationZVelocityReset = LightOrShadowSprite.RotationZVelocity;
            }
            else
            {
                LightOrShadowSpriteRotationZVelocityReset = LightOrShadowSprite.RelativeRotationZVelocity;
            }
            LightOrShadowSpriteAlphaReset     = LightOrShadowSprite.Alpha;
            LightOrShadowSpriteAlphaRateReset = LightOrShadowSprite.AlphaRate;
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected override void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mSpriteInstance      = new FlatRedBall.Sprite();
            mSpriteInstance.Name = "mSpriteInstance";
            mCircleInstance      = new FlatRedBall.Math.Geometry.Circle();
            mCircleInstance.Name = "mCircleInstance";
            LightSprite          = new FlatRedBall.Sprite();
            LightSprite.Name     = "LightSprite";
            // Not instantiating for AxisAlignedRectangle AxisAlignedRectangleInstance in Entities\Enemies\Rabbit2Enemy because properties on the object prevent it

            base.InitializeEntity(addToManagers);
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXReset = SpriteInstance.X;
            }
            else
            {
                SpriteInstanceXReset = SpriteInstance.RelativeX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYReset = SpriteInstance.Y;
            }
            else
            {
                SpriteInstanceYReset = SpriteInstance.RelativeY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZReset = SpriteInstance.Z;
            }
            else
            {
                SpriteInstanceZReset = SpriteInstance.RelativeZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXVelocityReset = SpriteInstance.XVelocity;
            }
            else
            {
                SpriteInstanceXVelocityReset = SpriteInstance.RelativeXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYVelocityReset = SpriteInstance.YVelocity;
            }
            else
            {
                SpriteInstanceYVelocityReset = SpriteInstance.RelativeYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZVelocityReset = SpriteInstance.ZVelocity;
            }
            else
            {
                SpriteInstanceZVelocityReset = SpriteInstance.RelativeZVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXReset = SpriteInstance.RotationX;
            }
            else
            {
                SpriteInstanceRotationXReset = SpriteInstance.RelativeRotationX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYReset = SpriteInstance.RotationY;
            }
            else
            {
                SpriteInstanceRotationYReset = SpriteInstance.RelativeRotationY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZReset = SpriteInstance.RotationZ;
            }
            else
            {
                SpriteInstanceRotationZReset = SpriteInstance.RelativeRotationZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RotationXVelocity;
            }
            else
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RelativeRotationXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RotationYVelocity;
            }
            else
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RelativeRotationYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RotationZVelocity;
            }
            else
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RelativeRotationZVelocity;
            }
            SpriteInstanceAlphaReset     = SpriteInstance.Alpha;
            SpriteInstanceAlphaRateReset = SpriteInstance.AlphaRate;
            if (CircleInstance.Parent == null)
            {
                CircleInstanceXReset = CircleInstance.X;
            }
            else
            {
                CircleInstanceXReset = CircleInstance.RelativeX;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceYReset = CircleInstance.Y;
            }
            else
            {
                CircleInstanceYReset = CircleInstance.RelativeY;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceZReset = CircleInstance.Z;
            }
            else
            {
                CircleInstanceZReset = CircleInstance.RelativeZ;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceXVelocityReset = CircleInstance.XVelocity;
            }
            else
            {
                CircleInstanceXVelocityReset = CircleInstance.RelativeXVelocity;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceYVelocityReset = CircleInstance.YVelocity;
            }
            else
            {
                CircleInstanceYVelocityReset = CircleInstance.RelativeYVelocity;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceZVelocityReset = CircleInstance.ZVelocity;
            }
            else
            {
                CircleInstanceZVelocityReset = CircleInstance.RelativeZVelocity;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationXReset = CircleInstance.RotationX;
            }
            else
            {
                CircleInstanceRotationXReset = CircleInstance.RelativeRotationX;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationYReset = CircleInstance.RotationY;
            }
            else
            {
                CircleInstanceRotationYReset = CircleInstance.RelativeRotationY;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationZReset = CircleInstance.RotationZ;
            }
            else
            {
                CircleInstanceRotationZReset = CircleInstance.RelativeRotationZ;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationXVelocityReset = CircleInstance.RotationXVelocity;
            }
            else
            {
                CircleInstanceRotationXVelocityReset = CircleInstance.RelativeRotationXVelocity;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationYVelocityReset = CircleInstance.RotationYVelocity;
            }
            else
            {
                CircleInstanceRotationYVelocityReset = CircleInstance.RelativeRotationYVelocity;
            }
            if (CircleInstance.Parent == null)
            {
                CircleInstanceRotationZVelocityReset = CircleInstance.RotationZVelocity;
            }
            else
            {
                CircleInstanceRotationZVelocityReset = CircleInstance.RelativeRotationZVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteXReset = LightSprite.X;
            }
            else
            {
                LightSpriteXReset = LightSprite.RelativeX;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteYReset = LightSprite.Y;
            }
            else
            {
                LightSpriteYReset = LightSprite.RelativeY;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteZReset = LightSprite.Z;
            }
            else
            {
                LightSpriteZReset = LightSprite.RelativeZ;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteXVelocityReset = LightSprite.XVelocity;
            }
            else
            {
                LightSpriteXVelocityReset = LightSprite.RelativeXVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteYVelocityReset = LightSprite.YVelocity;
            }
            else
            {
                LightSpriteYVelocityReset = LightSprite.RelativeYVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteZVelocityReset = LightSprite.ZVelocity;
            }
            else
            {
                LightSpriteZVelocityReset = LightSprite.RelativeZVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationXReset = LightSprite.RotationX;
            }
            else
            {
                LightSpriteRotationXReset = LightSprite.RelativeRotationX;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationYReset = LightSprite.RotationY;
            }
            else
            {
                LightSpriteRotationYReset = LightSprite.RelativeRotationY;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationZReset = LightSprite.RotationZ;
            }
            else
            {
                LightSpriteRotationZReset = LightSprite.RelativeRotationZ;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationXVelocityReset = LightSprite.RotationXVelocity;
            }
            else
            {
                LightSpriteRotationXVelocityReset = LightSprite.RelativeRotationXVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationYVelocityReset = LightSprite.RotationYVelocity;
            }
            else
            {
                LightSpriteRotationYVelocityReset = LightSprite.RelativeRotationYVelocity;
            }
            if (LightSprite.Parent == null)
            {
                LightSpriteRotationZVelocityReset = LightSprite.RotationZVelocity;
            }
            else
            {
                LightSpriteRotationZVelocityReset = LightSprite.RelativeRotationZVelocity;
            }
            LightSpriteAlphaReset     = LightSprite.Alpha;
            LightSpriteAlphaRateReset = LightSprite.AlphaRate;
        }
Esempio n. 57
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            mCollisionBox       = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mCollisionBox.Name  = "mCollisionBox";

            PostInitialize();
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXReset = SpriteInstance.X;
            }
            else
            {
                SpriteInstanceXReset = SpriteInstance.RelativeX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYReset = SpriteInstance.Y;
            }
            else
            {
                SpriteInstanceYReset = SpriteInstance.RelativeY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZReset = SpriteInstance.Z;
            }
            else
            {
                SpriteInstanceZReset = SpriteInstance.RelativeZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceXVelocityReset = SpriteInstance.XVelocity;
            }
            else
            {
                SpriteInstanceXVelocityReset = SpriteInstance.RelativeXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceYVelocityReset = SpriteInstance.YVelocity;
            }
            else
            {
                SpriteInstanceYVelocityReset = SpriteInstance.RelativeYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceZVelocityReset = SpriteInstance.ZVelocity;
            }
            else
            {
                SpriteInstanceZVelocityReset = SpriteInstance.RelativeZVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXReset = SpriteInstance.RotationX;
            }
            else
            {
                SpriteInstanceRotationXReset = SpriteInstance.RelativeRotationX;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYReset = SpriteInstance.RotationY;
            }
            else
            {
                SpriteInstanceRotationYReset = SpriteInstance.RelativeRotationY;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZReset = SpriteInstance.RotationZ;
            }
            else
            {
                SpriteInstanceRotationZReset = SpriteInstance.RelativeRotationZ;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RotationXVelocity;
            }
            else
            {
                SpriteInstanceRotationXVelocityReset = SpriteInstance.RelativeRotationXVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RotationYVelocity;
            }
            else
            {
                SpriteInstanceRotationYVelocityReset = SpriteInstance.RelativeRotationYVelocity;
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RotationZVelocity;
            }
            else
            {
                SpriteInstanceRotationZVelocityReset = SpriteInstance.RelativeRotationZVelocity;
            }
            SpriteInstanceAlphaReset     = SpriteInstance.Alpha;
            SpriteInstanceAlphaRateReset = SpriteInstance.AlphaRate;
            if (CollisionBox.Parent == null)
            {
                CollisionBoxXReset = CollisionBox.X;
            }
            else
            {
                CollisionBoxXReset = CollisionBox.RelativeX;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxYReset = CollisionBox.Y;
            }
            else
            {
                CollisionBoxYReset = CollisionBox.RelativeY;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxZReset = CollisionBox.Z;
            }
            else
            {
                CollisionBoxZReset = CollisionBox.RelativeZ;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxXVelocityReset = CollisionBox.XVelocity;
            }
            else
            {
                CollisionBoxXVelocityReset = CollisionBox.RelativeXVelocity;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxYVelocityReset = CollisionBox.YVelocity;
            }
            else
            {
                CollisionBoxYVelocityReset = CollisionBox.RelativeYVelocity;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxZVelocityReset = CollisionBox.ZVelocity;
            }
            else
            {
                CollisionBoxZVelocityReset = CollisionBox.RelativeZVelocity;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationXReset = CollisionBox.RotationX;
            }
            else
            {
                CollisionBoxRotationXReset = CollisionBox.RelativeRotationX;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationYReset = CollisionBox.RotationY;
            }
            else
            {
                CollisionBoxRotationYReset = CollisionBox.RelativeRotationY;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationZReset = CollisionBox.RotationZ;
            }
            else
            {
                CollisionBoxRotationZReset = CollisionBox.RelativeRotationZ;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationXVelocityReset = CollisionBox.RotationXVelocity;
            }
            else
            {
                CollisionBoxRotationXVelocityReset = CollisionBox.RelativeRotationXVelocity;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationYVelocityReset = CollisionBox.RotationYVelocity;
            }
            else
            {
                CollisionBoxRotationYVelocityReset = CollisionBox.RelativeRotationYVelocity;
            }
            if (CollisionBox.Parent == null)
            {
                CollisionBoxRotationZVelocityReset = CollisionBox.RotationZVelocity;
            }
            else
            {
                CollisionBoxRotationZVelocityReset = CollisionBox.RelativeRotationZVelocity;
            }
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 58
0
        private static Texture2D GenerateRadiusTexture(int maxRange, int minRange)
        {
            // Determine the new layer size
            var newTextureHeight = maxRange * 2;
            var newTextureWidth  = maxRange * 2;

            // This layer holds whatever we want drawn
            var temporaryLayer = new Layer();

            // Define the layer.
            var renderTarget = new RenderTarget2D(
                FlatRedBallServices.GraphicsDevice,
                newTextureWidth,
                newTextureHeight);

            temporaryLayer.RenderTarget = renderTarget;

            var maxRangeSprite = new Sprite
            {
                Texture        = RangeCircleTexture,
                TextureScale   = newTextureHeight / (float)RangeCircleTexture.Height,
                ColorOperation = ColorOperation.ColorTextureAlpha,
                Z     = 0,
                Red   = 0,
                Green = 255,
                Blue  = 0,
            };

            SpriteManager.AddToLayer(maxRangeSprite, temporaryLayer);

            var minRangeSprite = new Sprite
            {
                Texture      = MinRangeCircleTexture,
                TextureScale = minRange * 2 / (float)MinRangeCircleTexture.Height,
                //ColorOperation = ColorOperation.Subtract,
                ColorOperation = ColorOperation.ColorTextureAlpha,
                Z     = 1,
                Red   = 255,
                Green = 0,
                Blue  = 0,
            };

            SpriteManager.AddToLayer(minRangeSprite, temporaryLayer);

            // Rendering requires a camera. We'll create a temporary one (don't add it to the SpriteManager)
            var temporaryCamera = new Camera(null, newTextureWidth, newTextureHeight)
            {
                DrawsWorld = false, Z = 40
            };

            // We only want the camera to draw the layer
            temporaryCamera.UsePixelCoordinates();
            temporaryCamera.AddLayer(temporaryLayer);

            FlatRedBall.Graphics.Renderer.DrawCamera(temporaryCamera, null);

            //using (var fileStream = File.Create("range.png"))
            //{
            //    renderTarget.SaveAsPng(fileStream, newTextureWidth, newTextureHeight);
            //}

            SpriteManager.RemoveSprite(maxRangeSprite);
            SpriteManager.RemoveSprite(minRangeSprite);

            FlatRedBallServices.AddDisposable(
                "Max" + maxRange.ToString() + "Min" + minRange.ToString() + ".png",
                renderTarget,
                "ContentManagerName");

            return(renderTarget);
        }
Esempio n. 59
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            XBoxXButton = XboxX.Sprites.FindByName("xbox-button-x1").Clone();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 60
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SolidCollision      = new FlatRedBall.TileCollisions.TileShapeCollection();
            PlayerInstance      = new Soccer.Entities.Player(ContentManagerName, false);
            PlayerInstance.Name = "PlayerInstance";
            {
                var temp    = new FlatRedBall.Math.Collision.DelegateCollisionRelationship <Soccer.Entities.Player, FlatRedBall.TileCollisions.TileShapeCollection>(PlayerInstance, SolidCollision);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, first.AxisAlignedRectangleInstance, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                PlayerInstanceAxisAlignedRectangleInstanceVsSolidCollision = temp;
            }
            PlayerInstanceAxisAlignedRectangleInstanceVsSolidCollision.Name = "PlayerInstanceAxisAlignedRectangleInstanceVsSolidCollision";

            // Not instantiating for LayeredTileMap Map in Screens\GameScreen (Screen) because properties on the object prevent it
            BallList      = new FlatRedBall.Math.PositionedObjectList <Soccer.Entities.Ball>();
            BallList.Name = "BallList";
            BallListVsPlayerInstanceAxisAlignedRectangleInstance = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(BallList, PlayerInstance);
            BallListVsPlayerInstanceAxisAlignedRectangleInstance.SetSecondSubCollision(item => item.AxisAlignedRectangleInstance);
            BallListVsPlayerInstanceAxisAlignedRectangleInstance.Name = "BallListVsPlayerInstanceAxisAlignedRectangleInstance";
            BallListVsPlayerInstanceAxisAlignedRectangleInstance.SetBounceCollision(0f, 1f, 0.5f);

            BallListVsSolidCollision      = FlatRedBall.Math.Collision.CollisionManagerTileShapeCollectionExtensions.CreateTileRelationship(FlatRedBall.Math.Collision.CollisionManager.Self, BallList, SolidCollision);
            BallListVsSolidCollision.Name = "BallListVsSolidCollision";
            BallListVsSolidCollision.SetBounceCollision(0f, 1f, 0.8f);

            GoalCollision = new FlatRedBall.TileCollisions.TileShapeCollection();
            {
                var temp    = new FlatRedBall.Math.Collision.DelegateCollisionRelationship <Soccer.Entities.Player, FlatRedBall.TileCollisions.TileShapeCollection>(PlayerInstance, GoalCollision);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, first.AxisAlignedRectangleInstance, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                PlayerInstanceAxisAlignedRectangleInstanceVsGoalCollision = temp;
            }
            PlayerInstanceAxisAlignedRectangleInstanceVsGoalCollision.Name = "PlayerInstanceAxisAlignedRectangleInstanceVsGoalCollision";

            BallListCollisionCircleVsGoalCollision = FlatRedBall.Math.Collision.CollisionManagerTileShapeCollectionExtensions.CreateTileRelationship(FlatRedBall.Math.Collision.CollisionManager.Self, BallList, GoalCollision);
            BallListCollisionCircleVsGoalCollision.SetFirstSubCollision(item => item.CollisionCircle);
            BallListCollisionCircleVsGoalCollision.Name = "BallListCollisionCircleVsGoalCollision";

            GoalDisplay      = new FlatRedBall.Sprite();
            GoalDisplay.Name = "GoalDisplay";
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PlayerInstance, BallList);
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle.SetFirstSubCollision(item => item.BallCatchArea);
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle.SetSecondSubCollision(item => item.CollisionCircle);
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle.Name = "PlayerInstanceBallCatchAreaVsBallListCollisionCircle";

            UpSpringCollision = new FlatRedBall.TileCollisions.TileShapeCollection();
            PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision = FlatRedBall.Math.Collision.CollisionManagerTileShapeCollectionExtensions.CreateTileRelationship(FlatRedBall.Math.Collision.CollisionManager.Self, PlayerInstance, UpSpringCollision);
            PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision.Name = "PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision";

            BallListCollisionCircleVsUpSpringCollision = FlatRedBall.Math.Collision.CollisionManagerTileShapeCollectionExtensions.CreateTileRelationship(FlatRedBall.Math.Collision.CollisionManager.Self, BallList, UpSpringCollision);
            BallListCollisionCircleVsUpSpringCollision.SetFirstSubCollision(item => item.CollisionCircle);
            BallListCollisionCircleVsUpSpringCollision.Name = "BallListCollisionCircleVsUpSpringCollision";

            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (SolidCollision != null)
            {
                SolidCollision.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(SolidCollision, Map, "Solid");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (GoalCollision != null)
            {
                GoalCollision.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(GoalCollision, Map, "Goal");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (UpSpringCollision != null)
            {
                UpSpringCollision.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(UpSpringCollision, Map, "Spring");


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }