Ejemplo n.º 1
0
        public GameState()
        {
            Global.theCamShaker = new CameraShaker();
            Add(Global.theCamShaker);

            Global.theMusic = new Music(Assets.MUS_DRIVE);

            Global.theGhost = new Ghost(100, 100, false);

            theFloor = new Floor();
            theFloor.gfx.Frame = 1;
            while(theFloor.gfx.Frame == 1)
            {
                theFloor.gfx.Frame = Rand.Int(0, 7);
            }
            Add(theFloor);

            Add(Global.theGhost);
            Add(new Ghost(150, 150, true));

            ScoreText = new Text(((int)Global.Score).ToString() + "     B: " + Global.Bombs.ToString(), Assets.FONT, 16);

            ScoreText.X = 165 + CameraX;
            ScoreText.Y = 0 + CameraY;
            ScoreText.OutlineQuality = TextOutlineQuality.Best;
            ScoreText.OutlineColor = Color.Black;
            ScoreText.OutlineThickness = 2;
            ScoreText.Smooth = false;
            ScoreText.Scroll = 0;

            Ready = false;
        }
Ejemplo n.º 2
0
        public ResultScene(Bomberman winner)
        {
            string message = "Everyone is a loser.";
            if (winner != null)
                message = string.Format("{0} is the greatest!", winner.Session.Name);

            _titleMessage = new Text(message, 32)
            {
                Color = Color.Red,
                X = this.HalfWidth,
                Y = this.HalfHeight,
            };

            _instructionMessage = new Text("Press any key to replay", size: 20)
            {
                Color = Color.White,
                OutlineThickness = .5f,
                X = this.HalfWidth,
                Y = this.HalfHeight + 200
            };

            this.AddGraphic(_titleMessage);
            this.AddGraphic(_instructionMessage);

            this.OnUpdate = () =>
            {
                if (Game.Input.ButtonPressed(AxisButton.Any) || Game.Input.KeyPressed(Key.Any))
                {
                    Game.SwitchScene(new GameScene(1, Game.Input.JoysticksConnected));
                }
            };
        }
Ejemplo n.º 3
0
        public override void Update()
        {
            Ticks++;
            var scene = Scene as GameScene;

            if(!Initialized)
            {
                Initialized = true;
                DepthMeter = new Text("Depth: " + scene.Depth.ToString(), 32);
                DepthMeter.OutlineThickness = 2;
                DepthMeter.OutlineColor = Color.Black;
                DepthMeter.Color = Color.White;
                DepthMeter.Y = 50;
                DepthMeter.X = 810;
                scene.AddGraphic(DepthMeter);
            }

            if (scene.Player.Controller.Up.Pressed)
                OrderMove(MovementDirection.Up);
            else if (scene.Player.Controller.Down.Pressed)
                OrderMove(MovementDirection.Down);
            else if (scene.Player.Controller.Left.Pressed)
                OrderMove(MovementDirection.Left);
            else if (scene.Player.Controller.Right.Pressed)
                OrderMove(MovementDirection.Right);

            if (Game.Framerate > 1 && Ticks % (int)Game.Framerate == 0)
                UnitManager.ProceedTurn();
        }
Ejemplo n.º 4
0
		public override void Added()
		{
			base.Added();

			Text_Time = new Otter.Text( "", 32 );
			{
				Text_Time.X = X;
				Text_Time.Y = Y;
				Text_Time.CenterOrigin();
				Text_Time.OutlineColor = Color.Black;
				Text_Time.OutlineThickness = 2;
			}
			Parent.AddGraphic( Text_Time );

			// Initialize the fade in/out
			Alpha = new ClampedSpeedValueClass();
			{
				Alpha.Value = 0;
				Alpha.Minimum = 0;
				Alpha.Maximum = 1;
				Alpha.Speed = FADE_SPEED;
			}

			// Update the images to have this initial alpha value
			foreach ( Graphic graphic in Parent.Graphics )
			{
				graphic.Alpha = Alpha.Value;
			}
		}
Ejemplo n.º 5
0
		public override void Added()
		{
			base.Added();

			// Initialize the key graphic
			Image_Key = new Otter.Image( "../../resources/key.png" ); // Initialize to element type
			{
				Image_Key.CenterOrigin();
				Image_Key.X = X;
				Image_Key.Y = Y;
			}
			AddGraphic( Image_Key );

			// Initialize this key's character text display
			KeyCharacter = new Text( Key, 48 );
			{
				KeyCharacter.CenterOrigin();
				KeyCharacter.OriginY = Image_Key.HalfHeight;
				KeyCharacter.X = X;
				KeyCharacter.Y = Y;
				KeyCharacter.OutlineThickness = 4;
				KeyCharacter.OutlineQuality = TextOutlineQuality.Absurd;
			}
			AddGraphic( KeyCharacter );
		}
Ejemplo n.º 6
0
		public override void Added()
		{
			base.Added();

			// Get reference to GameWands interface for handling Leap Tools
			GameWands = ( (Scene_GameClass) Scene ).GameWands;

			Text_Warning = new Otter.Text( "", 32 );
			{
				Text_Warning.X = X;
				Text_Warning.Y = Y;
				Text_Warning.CenterOrigin();
				Text_Warning.OutlineThickness = 2;
			}
			Parent.AddGraphic( Text_Warning );

			// Initialize the cable offset
			Alpha = new ClampedSpeedValueClass();
			{
				Alpha.Value = 0;
				Alpha.Minimum = 0;
				Alpha.Maximum = 1;
				Alpha.Speed = FADE_SPEED;
			}

			// Update the images to have this initial alpha value
			foreach ( Graphic graphic in Parent.Graphics )
			{
				graphic.Alpha = Alpha.Value;
			}
		}
Ejemplo n.º 7
0
        public Unit(string spritePath, Team team, Point position, Type type)
        {
            _handle = GoodRnd.gen.Next(Int32.MinValue, Int32.MaxValue);
             if (team == Team.Red) spritePath = @"red/" + spritePath;
             else spritePath = @"blu/" + spritePath; ;
            _sprite = new Image(spritePath);
            Bar = new Text(16);

            _team = team;
            X = position.X;
            Y = position.Y;

            _type = type;

            _direction = new Vector2(0);

            if (_team == Team.Red)
            {
                Teams.redTeam.Add(this);
                _targetPoint = new Point(Global.bluAncientCoords.X, 900);
            }
            else
            {
                StatisticWatcher.trackUnitsProduced(1);
                Teams.bluTeam.Add(this);
                _targetPoint = new Point(Global.redAncientCoords.X, -100);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Create a list menu
        /// </summary>
        public ListMenu(string menuDescription, string enumName, OnSelection callback, int X = 500, int Y = 100, int width = 280, int height = 520)
            : base(X, Y, Image.CreateRectangle(width, height))
        {
            //enum magic
            Type enumType = Type.GetType(enumName);

            if (enumType == null)
                throw new ArgumentException("Specified enum type could not be found", nameof(enumName));

            //save callback
            _callback = callback;

            //register callback for scene add
            OnAdded += OnAdd;

            //set enter to blocked on begin to avoid double-entering menus
            _blockedKeys[2] = true;

            //set background
            Graphic.Color = Color.Gray;

            //draw a info text
            _infoText = new Text(menuDescription, 48)
            {
                X = X,
                Color = Color.Black,
                Y = Y - 50
            };

            //define this entity as part of the menu pause group
            Group = (int) PauseGroups.Menu;

            //how to draw a menu follows

            float paddingPercentage = 0.1f;

            //Magic.Cast(how many items are in the enum?)
            int numberOfEnumItems = Enum.GetNames(enumType).Length;

            int paddingHeight = (int) ((height / numberOfEnumItems) * paddingPercentage);
            int paddingWidth = (int) ((width / numberOfEnumItems) * paddingPercentage);

            //height per item
            int itemHeight = ((height - ((paddingHeight * (numberOfEnumItems + 1)))) / numberOfEnumItems);
            int itemWidth = width - paddingWidth * 2;

            //list of the items in the enum
            Array enumList = Enum.GetValues(enumType);//A wild magical unicorn appears

            //add menu item for each enum item
            for (int i = 0; i < enumList.Length; i++){
                MenuChoice newChoice = new MenuChoice(X + paddingWidth,
                    Y + paddingHeight + (i * paddingHeight) + i * itemHeight,
                    itemWidth,
                    itemHeight,
                    enumList.GetValue(i).ToString());
                _choiceList.Add(newChoice);
            }
        }
Ejemplo n.º 9
0
 public DamageText(float x, float y, string dmgText, int fontSize = 16) : base(x, y)
 {
     text = new Text(dmgText, Resources.Fonts.FONT_MAIN, fontSize);
     text.Color = Color.Red;
     X = x + Otter.Rand.Int(0, 30);
     Y = y - 20;
     Graphic = text;
 }
Ejemplo n.º 10
0
 public TextDialog(OnAccept callback, string description, Predicate<string> predicate, string startingValue)
 {
     //save the predicate that is used to determine whether the result is acceptable
     _valueAcceptancePredicate = predicate;
     //init the description
     _descriptionText = new Text(description, 32) {Color = Color.Black};
     //register callback for after having been added to a scene
     OnAdded += OnAdd;
     //save callback
     _callback = callback;
     //set group to avoid pausing this
     Group = (int) PauseGroups.Menu;
     //reset input
     _startingInputValue = startingValue;
 }
Ejemplo n.º 11
0
        public override void Removed()
        {
            var scene = Scene as GameScene;

            var GameOverMessage = new Text("YOU DIED", 32);
            GameOverMessage.OutlineThickness = 2;
            GameOverMessage.OutlineColor = Color.Black;
            GameOverMessage.Color = Color.White;
            GameOverMessage.Y = 400;
            GameOverMessage.X = 500;
            GameOverMessage.CenterOrigin();
            scene.AddGraphic(GameOverMessage);
            scene.Clear();
            base.Removed();
        }
Ejemplo n.º 12
0
 public Hero(float x, float y)
     : base(x, y, "res/characters/hero.png", false)
 {
     IssuedOrder = UnitOrder.Idle;
     HealthBar = new Text(Health.ToString(), 32);
     HealthBar.OutlineThickness = 2;
     HealthBar.OutlineColor = Color.Black;
     HealthBar.Color = Color.Green;
     HealthBar.Y = 10;
     HealthBar.X = 810;
     Strength = 2;
     Health = 200;
     HealthMax = 200;
     RegenerationRate = 1;
 }
Ejemplo n.º 13
0
		public override void Added()
		{
			base.Added();

			string text = "Loser!";
			{
				if ( Winner )
				{
					text = "Winner!";
				}
			}
			Text_Outcome = new Otter.Text( text, 96 );
			{
				Text_Outcome.X = X;
				Text_Outcome.Y = Y;
				Text_Outcome.CenterOrigin();
				Text_Outcome.OriginY = Text_Outcome.Height;
				Text_Outcome.OutlineThickness = 4;
			}
			Parent.AddGraphic( Text_Outcome );

			Text_Score = new Otter.Text( Score.ToString(), 96 );
			{
				Text_Score.X = X;
				Text_Score.Y = Y;
				Text_Score.CenterOrigin();
				Text_Score.OriginY = -Text_Score.Height;
				Text_Score.OutlineThickness = 4;
			}
			Parent.AddGraphic( Text_Score );

			// Initialize the cable offset
			Alpha = new ClampedSpeedValueClass();
			{
				Alpha.Value = 0;
				Alpha.Minimum = 0;
				Alpha.Maximum = 1;
				Alpha.Speed = FADE_SPEED;
			}

			// Update the images to have this initial alpha value
			foreach ( Graphic graphic in Parent.Graphics )
			{
				graphic.Alpha = Alpha.Value;
			}
		}
Ejemplo n.º 14
0
        public Toast(string content, int duration = 1000)
        {
            _duration = duration;

            _content = new Text(24)
            {
                String = content,
                Color = Color.Black,
                X = 50,
                Y = 50
            };

            _background = Image.CreateRectangle(_content.Width + 20, _content.Height + 20, Color.White);
            _background.X = _content.X - 10;
            _background.Y = _content.Y - 10;

            OnAdded += OnAdd;
        }
Ejemplo n.º 15
0
 public Unit(float x, float y, string sprite, bool useAI)
 {
     X = x;
     Y = y;
     Graphic = new Image(sprite);
     IssuedOrder = UnitOrder.Wander;
     ControlledByAI = useAI;
     UnitManager.Units.Add(this);
     MovementManager.AddUnitToUnitMap(this);
     Health = 100;
     HealthMax = 100;
     RegenerationRate = 0.3f;
     if (useAI)
     {
         HealthBar = new Text(Health.ToString(), 10);
         HealthBar.OutlineThickness = 2;
         HealthBar.OutlineColor = Color.Black;
         HealthBar.Color = Color.Red;
         HealthBar.Y = -16;
         HealthBar.X = 0;
         Graphics.Add(HealthBar);
     }
 }
Ejemplo n.º 16
0
        public Arrow(float x, float y, float newTargetX, float newTargetY, float framesTillHit, int newDir) : base(x, y)
        {
            this.framesTillHit = framesTillHit;
            targetX = newTargetX;
            targetY = newTargetY;

            dir = newDir;
            key = keys[dir];

            Vector2 delta = new Vector2(targetX - X, newTargetY - Y);
            velocity = delta / framesTillHit;
            
            img = new Image("Graphics/arrow.png");
            img.Angle = -(dir * 90);
            img.Scale = 1;
            img.CenterOrigin();
            text = new Text();
            text.CenterTextOrigin();
            
            AddGraphic(text);
            AddGraphic(img);

            base.Layer = 1000;
        }
Ejemplo n.º 17
0
            /// <summary>
            /// Creates a new menuchoice at the given position with the given size with custom colors
            /// </summary>
            public MenuChoice(int x, int y, int width, int height, string name, Color unselected, Color selected)
                : base(x, y)
            {
                //define this entity as part of the menu pause group
                Group = (int)PauseGroups.Menu;

                //create text item
                _choice = new Text(name, 32);

                //position it
                _choice.X = x + (width - _choice.Width) / 2;
                _choice.Y = y + (height - _choice.Height) / 2;

                //create background
                Image background = Image.CreateRectangle(width, height, unselected);
                AddGraphic(background);

                //save colors
                _unselectedColor = unselected;
                _selectedColor = selected;
            }
Ejemplo n.º 18
0
		public override void Added()
		{
			base.Added();

			// Initialize the background Leap cable image
			Image_LeapCable_Background = new Otter.Image( "../../resources/leap/leapcableback.png" );
			{
				Image_LeapCable_Background.X = X;
				Image_LeapCable_Background.Y = Y;
				Image_LeapCable_Background.CenterOrigin();
				Image_LeapCable_Background.OriginX = Image_LeapCable_Background.Width + 32;
			}
			Parent.AddGraphic( Image_LeapCable_Background );

			// Initialize the Leap cable image
			Image_LeapCable = new Otter.Image( "../../resources/leap/leapcable.png" );
			{
				Image_LeapCable.X = X;
				Image_LeapCable.Y = Y;
				Image_LeapCable.CenterOrigin();
				Image_LeapCable.OriginX = Image_LeapCable.Width + 32;
			}
			Parent.AddGraphic( Image_LeapCable );

			// Initialize the Leap controller image
			Image_Leap = new Otter.Image( "../../resources/leap/leapmotion.png" );
			{
				Image_Leap.X = X;
				Image_Leap.Y = Y;
				Image_Leap.CenterOrigin();
				Image_Leap.OriginX = 0;
			}
			Parent.AddGraphic( Image_Leap );

			Text_Warning = new Otter.Text( "Plug in Leap Motion Controller device", 16 );
			{
				Text_Warning.X = X + 55;
				Text_Warning.Y = Y;
				Text_Warning.CenterOrigin();
			}
			Parent.AddGraphic( Text_Warning );

			// Initialize the cable offset
			Cable = new ClampedSpeedValueClass();
			{
				Cable.Value = 32;
				Cable.Minimum = -6;
				Cable.Maximum = 32;
			}

			// Initialize the cable offset
			Alpha = new ClampedSpeedValueClass();
			{
				Alpha.Value = 0;
				Alpha.Minimum = 0;
				Alpha.Maximum = 1;
				Alpha.Speed = FADE_SPEED;
			}

			// Update the images to have this initial alpha value
			foreach ( Graphic graphic in Parent.Graphics )
			{
				graphic.Alpha = Alpha.Value;
			}
		}
Ejemplo n.º 19
0
        public ListMenu(string menuDescription, List<string> choiceNames, OnSelection callback, int X = 500, int Y = 100, int width = 280, int height = 520)
            : base(X, Y, Image.CreateRectangle(width, height))
        {
            //save callback
            _callback = callback;

            //register callback for scene add
            OnAdded += OnAdd;

            //set enter to blocked on begin to avoid double-entering menus
            _blockedKeys[2] = true;

            //set background
            Graphic.Color = Color.Gray;

            //draw a info text
            _infoText = new Text(menuDescription, 48)
            {
                X = X,
                Color = Color.Black,
                Y = Y - 50
            };

            //define this entity as part of the menu pause group
            Group = (int)PauseGroups.Menu;

            //how to draw a menu follows

            float paddingPercentage = 0.1f;

            //Magic.Cast(how many items are in the enum?)
            int numberOfEnumItems = choiceNames.Count;

            int paddingHeight = (int)((height / numberOfEnumItems) * paddingPercentage);
            int paddingWidth = (int)((width / numberOfEnumItems) * paddingPercentage);

            //height per item
            int itemHeight = ((height - ((paddingHeight * (numberOfEnumItems + 1)))) / numberOfEnumItems);
            int itemWidth = width - paddingWidth * 2;

            //add menu item for each enum item
            for (int i = 0; i < choiceNames.Count; i++)
            {
                MenuChoice newChoice = new MenuChoice(X + paddingWidth,
                    Y + paddingHeight + (i * paddingHeight) + i * itemHeight,
                    itemWidth,
                    itemHeight,
                    choiceNames[i]);
                _choiceList.Add(newChoice);
            }
        }
		public override void Added()
		{
			base.Added();

			float height = 16;

			// Initialize the Team Member's image
			Image_Avatar = new Otter.Image( "../../resources/team/" + Username + ".png" );
			{
				Image_Avatar.Scale = IMAGE_SCALE;
				Image_Avatar.X = X;
				Image_Avatar.Y = Y;
				Image_Avatar.CenterOrigin();
				Image_Avatar.OriginY += IMAGE_OFFSET_TEXT;
			}
			AddGraphic( Image_Avatar );

			// Store the y offset for text elements
			float offsety = ( IMAGE_OFFSET_TEXT * Image_Avatar.Width * Image_Avatar.ScaleX );

			// Initialize the Team Member's twitter username
			Text_Name = new Otter.Text( Name, FONT_SIZE );
			{
				Text_Name.X = X - offsety;
				Text_Name.Y = Y;
				Text_Name.CenterOrigin();

				// Add to the offset for the next text
				offsety += height * TEXT_OFFSET_SCALE;
			}
			AddGraphic( Text_Name );

			// Initialize the Team Member's role
			Text_Role = new Otter.Text( Role, FONT_SIZE );
			{
				Text_Role.X = X - offsety;
				Text_Role.Y = Y;
				Text_Role.CenterOrigin();

				// Add to the offset for the next text
				offsety += height * TEXT_OFFSET_SCALE;
			}
			AddGraphic( Text_Role );

			// Add extra offset between name&role, and contact details
			offsety += Text_Role.Height * TEXT_OFFSET_SCALE / 2;

			// Initialize the Team Member's twitter username
			Text_Username = new Otter.Text( "@" + Username, FONT_SIZE );
			{
				Text_Username.X = X - offsety;
				Text_Username.Y = Y;
				Text_Username.CenterOrigin();

				// Add to the offset for the next text
				offsety += height * TEXT_OFFSET_SCALE;
			}
			AddGraphic( Text_Username );

			// Initialize the Team Member's website url
			Text_Website = new Otter.Text( Website, FONT_SIZE );
			{
				Text_Website.X = X - offsety;
				Text_Website.Y = Y;
				Text_Website.CenterOrigin();

				// Add to the offset for the next text
				offsety += height * TEXT_OFFSET_SCALE;
			}
			//AddGraphic( Text_Website );

			// Initialize the cable offset
			Alpha = new ClampedSpeedValueClass();
			{
				Alpha.Value = 0;
				Alpha.Minimum = 0;
				Alpha.Maximum = 1;
				Alpha.Speed = FADE_SPEED;
			}

			// Update the images to have this initial alpha value
			foreach ( Graphic graphic in Graphics )
			{
				graphic.Alpha = Alpha.Value;
			}
		}
Ejemplo n.º 21
0
		public override void Added()
		{
			base.Added();

			// The number of rows on the keyboard for positioning other elements
			short rows = 0;

			// Initialize entered text display
			Text_UserString = new Text( "@", 48 );
			{
				Text_UserString.CenterOrigin();
				Text_UserString.X = X + ( KEY_SIZE * 2 );
				Text_UserString.Y = Y;
				Text_UserString.OutlineThickness = 4;
				Text_UserString.OutlineQuality = TextOutlineQuality.Absurd;
			}
			AddGraphic( Text_UserString );

			// Initialie the array of key character strings
			KeyCharacter = new string[KEYS];
			{
				// Start key index at 0 to enable key++ in one line
				short key = 0;

				// Row 1
				KeyCharacter[key++] = "1";
				KeyCharacter[key++] = "2";
				KeyCharacter[key++] = "3";
				KeyCharacter[key++] = "4";
				KeyCharacter[key++] = "5";
				KeyCharacter[key++] = "6";
				KeyCharacter[key++] = "7";
				KeyCharacter[key++] = "8";
				KeyCharacter[key++] = "9";
				KeyCharacter[key++] = "0";
				KeyCharacter[key++] = "_";

				// Row 2
				KeyCharacter[key++] = "Q";
				KeyCharacter[key++] = "W";
				KeyCharacter[key++] = "E";
				KeyCharacter[key++] = "R";
				KeyCharacter[key++] = "T";
				KeyCharacter[key++] = "Y";
				KeyCharacter[key++] = "U";
				KeyCharacter[key++] = "I";
				KeyCharacter[key++] = "O";
				KeyCharacter[key++] = "P";
				KeyCharacter[key++] = "";

				// Row 3
				KeyCharacter[key++] = "A";
				KeyCharacter[key++] = "S";
				KeyCharacter[key++] = "D";
				KeyCharacter[key++] = "F";
				KeyCharacter[key++] = "G";
				KeyCharacter[key++] = "H";
				KeyCharacter[key++] = "J";
				KeyCharacter[key++] = "K";
				KeyCharacter[key++] = "L";
				KeyCharacter[key++] = "";
				KeyCharacter[key++] = "";

				// Row 4
				KeyCharacter[key++] = "Z";
				KeyCharacter[key++] = "X";
				KeyCharacter[key++] = "C";
				KeyCharacter[key++] = "V";
				KeyCharacter[key++] = "B";
				KeyCharacter[key++] = "N";
				KeyCharacter[key++] = "M";
				KeyCharacter[key++] = "";
				KeyCharacter[key++] = "";
				KeyCharacter[key++] = "";
				KeyCharacter[key++] = "";
			}

			// Initialize the array of keys
			HUDElement_Child = new HUDElementClass[KEYS];
			{
				// Initialize key positions
				short column = 0;
				short row = 0;

				for ( short key = 0; key < KEYS; key++ )
				{
					// Check if the key exists before drawing it
					if ( KeyCharacter[key] != "" )
					{
						// Center the key row on the keyboard
						float startx = -( ( KEYS_ROW - 1 ) * ( KEY_SIZE + KEY_OFFSET ) / 2 ) + ( row * ( KEY_SIZE + KEY_OFFSET ) / 2 );
						// Offset the key by the current column
						float keyx = ( column * ( KEY_SIZE + KEY_OFFSET ) );
						// Offset the key by the current row
						float keyy = -( row * ( KEY_SIZE + KEY_OFFSET ) );

						HUDElement_Child[key] = new HUDElement_KeyClass(
							CurrentScene, // Reference to the current scene
							startx + keyx + X, // Position X
							keyy + Y, // Position Y
							KeyCharacter[key] // The key string to display
						);
						HUDElement_Child[key].Parent = this;
						HUDElement_Child[key].Layer = 1;
						CurrentScene.Add( HUDElement_Child[key] );
					}

					// Offset the button to the correct row and column
					column++;
					if ( column >= KEYS_ROW )
					{
						row++;
						column = 0;
					}
				}
				rows = row;
			}

			// Initialize instructional graphics
			float offsetx = ( rows * 2 * ( KEY_SIZE + KEY_OFFSET ) ) * 1.1f;

			// Fire, red, enter character
			Button_Fire = new Otter.Image( "../../resources/button.png" );
			{
				Button_Fire.Color = Color.Red;
				Button_Fire.CenterOrigin();
				Button_Fire.X = X - offsetx;
				Button_Fire.Y = Y;
			}
			AddGraphic( Button_Fire );

			Text_Enter = new Text( "Enter the selected character", 32 );
			{
				Text_Enter.OutlineThickness = 4;
				Text_Enter.CenterOrigin();
				Text_Enter.X = X - offsetx;
				Text_Enter.Y = Y;
			}
			AddGraphic( Text_Enter );

			// Move the two elements to be centered together
			{
				Button_Fire.OriginX = Button_Fire.HalfWidth * 1.1f + Text_Enter.HalfWidth;
				Text_Enter.OriginX = -Button_Fire.HalfWidth * 1.1f + Text_Enter.HalfWidth;
				Text_Enter.OriginY = Button_Fire.OriginY / 2;
			}
			offsetx += Button_Fire.Width * 1.1f;

			// Lightning, yellow, remove character
			Button_Lightning = new Otter.Image( "../../resources/button.png" );
			{
				Button_Lightning.Color = Color.Yellow;
				Button_Lightning.CenterOrigin();
				Button_Lightning.X = X - offsetx;
				Button_Lightning.Y = Y;
			}
			AddGraphic( Button_Lightning );

			Text_Remove = new Text( "Remove the last character", 32 );
			{
				Text_Remove.OutlineThickness = 4;
				Text_Remove.CenterOrigin();
				Text_Remove.X = X - offsetx;
				Text_Remove.Y = Y;
			}
			AddGraphic( Text_Remove );

			// Move the two elements to be centered together
			{
				Button_Lightning.OriginX = Button_Lightning.HalfWidth * 1.1f + Text_Remove.HalfWidth;
				Text_Remove.OriginX = -Button_Lightning.HalfWidth * 1.1f + Text_Remove.HalfWidth;
				Text_Remove.OriginY = Button_Lightning.OriginY / 2;
			}
			offsetx += Button_Lightning.Width * 1.1f;

			// Earth, green, toggle ready
			Button_Earth = new Otter.Image( "../../resources/button.png" );
			{
				Button_Earth.Color = Color.Green;
				Button_Earth.CenterOrigin();
				Button_Earth.X = X - offsetx;
				Button_Earth.Y = Y;
			}
			AddGraphic( Button_Earth );

			Text_Ready = new Text( "Ready to tweet", 32 );
			{
				Text_Ready.OutlineThickness = 4;
				Text_Ready.CenterOrigin();
				Text_Ready.X = X - offsetx;
				Text_Ready.Y = Y;
			}
			AddGraphic( Text_Ready );

			// Move the two elements to be centered together
			{
				Button_Earth.OriginX = Button_Earth.HalfWidth * 1.1f + Text_Ready.HalfWidth;
				Text_Ready.OriginX = -Button_Earth.HalfWidth * 1.1f + Text_Ready.HalfWidth;
				Text_Ready.OriginY = Button_Earth.OriginY / 2;
			}
			offsetx += Button_Earth.Width * 1.1f;

			// Initialize as parent to Key elements
			IsParent = true;

			// Initialzie the controller session
			ControllerSession = Game.Instance.Sessions[Player];

			// Flag an update to ensure that the first key is highlighted
			FirstUpdate = true;

			// Initialize unready
			Ready = false;

			// Draw the preview tweet a layer above the keyboard
			Layer = 0;
		}
Ejemplo n.º 22
0
		public override void Added()
		{
			base.Added();

			// Add each team member to the screen
			for ( short member = 0; member < TEAM_MEMBERS; member++ )
			{
				HUDElement_Child[member] = new HUDElement_TeamMemberClass(
						CurrentScene, // Reference to the current scene
						TeamMember[member].Name, // Member name
						TeamMember[member].Username, // Member username
						TeamMember[member].Role, // Member role
						TeamMember[member].Website, // Member website
						( Game.Instance.HalfHeight / ( TEAM_MEMBERS + 1 ) * ( member + 1 ) ) + X, // X
						150 + ( ( member % 2 ) * 100 ) + Y // Y, Offset even team members for spacing
				);
				HUDElement_Child[member].Parent = this;
				CurrentScene.Add( HUDElement_Child[member] );
			}

			// Add the title text to the credits
			Text title = new Text( "TRAGIC MAGIC", 128 );
			{
				title.Y = Game.Instance.HalfHeight / 2;
			}
			AddGraphic( title );
		}