public override void Added() { base.Added(); // Create main fire ball particle system Particle_Dust = new ParticleSystem( X, Y ); Particle_Dust.Initialize( 50, 20, 0, 360, 5, 15, "../../resources/particle/smoke.png", 87, 87, 0.8f ); Particle_Dust.particleShake = 1; Particle_Dust.beginColour = Color.Gray * Color.Gray * Color.Orange + Color.Gray; Particle_Dust.beginColour.A = 0.5f; Particle_Dust.endColour = Color.Black; Particle_Dust.endColour.A = 0; Particle_Dust.particleEndScale = 5.0f; Particle_Dust.particleStartRotation = Rand.Float( -720, 720 ); Particle_Dust.particleEndRotation = Rand.Float( -720, 720 ); Particle_Dust.particleLocalSpace = true; Particle_Dust.Start(); Scene.Add( Particle_Dust ); // Intitialize the ground trail mark image GroundTrail = new Otter.Image( "../../resources/particle/scorch.png" ); // Initialize trail mark timers to seconds TrailBetween = TRAIL_BETWEEN * 60; TrailBetweenRandom = TRAIL_BETWEEN_RANDOM * 60; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the dust storm audio loop AudioLoop = new Sound( "../../resources/audio/dust.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
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 ); }
public override void Added() { base.Added(); // Create main fireball particle system Particle_Fire = new ParticleSystem( X, Y ); Particle_Fire.Initialize( 50, 20, 0, 360, 5, 15, "../../resources/particle/fire.png", 87, 87, 0.8f ); Particle_Fire.beginColour = Color.Orange + ( Color.Yellow * Color.Gray * Color.Gray ); Particle_Fire.endColour = Color.Red; Particle_Fire.endColour.A = 0; Particle_Fire.particleLocalSpace = true; Particle_Fire.Start(); Scene.Add( Particle_Fire ); // Create fireball trail particle system Particle_Fire_Trail = new ParticleSystem( X, Y ); Particle_Fire_Trail.Initialize( 100, 20, 0, 180, 5, 10, "../../resources/particle/fire.png", 87, 87, 0.8f ); Particle_Fire_Trail.beginColour = Color.Orange + ( Color.Yellow * Color.Gray * Color.Gray ); Particle_Fire_Trail.endColour = Color.Red; Particle_Fire_Trail.endColour.A = 0; Particle_Fire_Trail.Start(); Scene.Add( Particle_Fire_Trail ); GroundSplat = new Otter.Image( "../../resources/particle/ground_explosion.png" ); // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/fire.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Added() { base.Added(); // Create main spell particle system Particle_Spray = new ParticleSystem( X, Y ); Particle_Spray.Initialize(10, 10, 0, 360, 15, 15, "../../resources/particle/water_circle.png", 87, 87, 1.5f); Particle_Spray.beginColour = Color.White; Particle_Spray.endColour = (Color.Blue * Color.Gray * Color.Gray); Particle_Spray.endColour.A = 0; Particle_Spray.particleShake = 4; Particle_Spray.particleStartRotation = Rand.Float(-360, 360); Particle_Spray.particleEndRotation = Rand.Float(-360, 360); Particle_Spray.Start(); Scene.Add(Particle_Spray); GroundSplat = new Otter.Image("../../resources/particle/splash.png"); GroundSplat.Color = Color.Cyan; GroundSplat.Scale = 2.5f; GroundSplat.Color.A = 0.4f; GroundTrail = new Otter.Image("../../resources/particle/splash.png"); GroundTrail.Color = Color.Cyan; GroundTrail.Color.A = 0.2f; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/water.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public void Initialize( Game game ) { // Initialize the ground surface render target GroundSurface = new Surface( 1920, 1080 ); GroundSurface.AutoClear = false; AddGraphic( GroundSurface ); // Initialize the ground graphic (Added in ClearGround) Ground = new Otter.Image( "../../resources/ground.png" ); // Set the reference to LeapController within the GameWands class & add to game update GameWands.LeapController = LeapController; GameWands.OnCast = OnCast; Add( GameWands ); // Initialize the two wizard players float wizardoffset = 256; // Create new wizard list Wizards = new List<WizardClass>(); { Wizards.Add( new WizardClass( game.Session( "LightWizard" ), GameWands, WizardTypeStruct.WIZARD_LIGHT, 0, 90 ) ); // Dark wizard on the left Wizards.Add( new WizardClass( game.Session( "DarkWizard" ), GameWands, WizardTypeStruct.WIZARD_DARK, 1, -90 ) ); } // Add the wizards to the scene. foreach ( WizardClass wiz in Wizards ) { wiz.CurrentScene = this; Add( wiz ); } // Add a reference of this scene to the HUDHandler HUDHandler = new HUDHandlerClass( this ); Add( HUDHandler ); // Setup state manager last TragicStateManager.CurrentScene = this; Add( TragicStateManager ); }
public AoEWeapon(Turret tower) : base(range:tower.Range, damage:1, cooldown: 13) { ShootSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_SHOOT); ShootSound.Volume = 0.2f; Tower = tower; Range = 100; RangeImage = Image.CreateCircle(100, new Color(0x25456320)); RangeImage.CenterOrigin(); Tower.AddGraphic(RangeImage); }
public override void Added() { base.Added(); // Add base rock image to projectile Graphic = new Otter.Image( "../../resources/particle/rock" + Rand.Int( 1, IMAGE_ROCKS ) + ".png" ); Graphic.CenterOrigin(); // Add the circling smaller rocks int extras = ROCK_EXTRA + Rand.Int( -ROCK_EXTRA_RANDOM, ROCK_EXTRA_RANDOM ); for ( int extra = 1; extra <= extras; extra++ ) { AddGraphic( new Otter.Image( "../../resources/particle/rock_small" + Rand.Int( 1, IMAGE_ROCKS_SMALL ) + ".png" ) ); Graphics[extra].OriginX = -ROCK_EXTRA_OFFSET; Graphics[extra].OriginY = -ROCK_EXTRA_OFFSET; Graphics[extra].Angle = 360 / extras * extra; } // Create main fire ball particle system Particle_Dust = new ParticleSystem( X, Y ); Particle_Dust.Initialize( 50, 20, 0, 360, 1, 15, "../../resources/particle/smoke.png", 87, 87, 0.8f ); Particle_Dust.particleShake = 1; Particle_Dust.beginColour = Color.Gray * Color.Gray * Color.Orange + Color.Gray; Particle_Dust.beginColour.A = 0.5f; Particle_Dust.endColour = Color.Black; Particle_Dust.endColour.A = 0; Particle_Dust.particleStartScale = 0.1f; Particle_Dust.particleEndScale = 1.0f; Particle_Dust.particleStartRotation = Rand.Float( -720, 720 ); Particle_Dust.particleEndRotation = Rand.Float( -720, 720 ); Particle_Dust.particleLocalSpace = true; Particle_Dust.Start(); Scene.Add( Particle_Dust ); // Intitialize the ground trail mark image GroundTrail = new Otter.Image( "../../resources/particle/scorch.png" ); // Initialize trail mark timers to seconds TrailBetween = TRAIL_BETWEEN * 60; TrailBetweenRandom = TRAIL_BETWEEN_RANDOM * 60; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the dust storm audio loop AudioLoop = new Sound( "../../resources/audio/dust.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Added() { base.Added(); float offsetsin = Rand.Float( -180, 180 ); // Create first vine VineSineOne = new SineWave( 5, 1, offsetsin ); VineOne = new ParticleSystem( X, Y - VineSineOne.Value * 100 ); VineOne.Initialize( 0, 0, 0, 0, 1, 60, "../../resources/particle/vine.png", 87, 87, 0.3f ); VineOne.beginColour = Color.Orange * Color.Gray; VineOne.endColour = ( Color.Green * Color.Gray * Color.Red ); VineOne.endColour.A = 0; VineOne.particleShake = 4; VineOne.particleStartRotation = ( VineSineOne.Value * ( 180.0f / (float) Math.PI ) ) * 2; VineOne.particleEndRotation = VineOne.particleStartRotation; VineOne.Start(); Scene.Add( VineOne ); this.AddComponent( VineSineOne ); // Create second vine VineSineTwo = new SineWave( 5, 1, 180.0f + offsetsin ); VineTwo = new ParticleSystem( X, Y - VineSineTwo.Value * 100 ); VineTwo.Initialize( 0, 0, 0, 0, 1, 60, "../../resources/particle/vine.png", 87, 87, 0.3f ); VineTwo.beginColour = Color.Orange * Color.Gray; VineTwo.endColour = ( Color.Green * Color.Gray * Color.Red ); VineTwo.endColour.A = 0; VineTwo.particleShake = 4; VineTwo.particleStartRotation = ( VineSineTwo.Value * ( 180.0f / (float) Math.PI ) ) * 2; VineTwo.particleEndRotation = VineTwo.particleStartRotation; VineTwo.Start(); Scene.Add( VineTwo ); this.AddComponent( VineSineTwo ); GroundTrail = new Otter.Image( "../../resources/particle/leaf.png" ); GroundTrail.Color = Color.Green * Color.Gray * Color.Yellow; TrailBetween = 5; TrailBetweenRandom = 5; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/vine.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public FirstScene() { Global.GAME.Debugger.ShowPerformance(5); var background = new Image(Resources.Sprites.BACKGROUND); background.Repeat = true; AddGraphic(background); Add(new Map()); Add(new AoEWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new AoEWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new AoEWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new AoEWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new AoEWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new ToCloserMonsterWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new ToCloserMonsterWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new ToCloserMonsterWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new ToCloserMonsterWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); Add(new ToCloserMonsterWeaponTurret(Rand.Float(Global.GAME.Width), Rand.Float(Global.GAME.Height))); MainSong.Play(); }
public override void Added() { base.Added(); // Initialize the array of element images Image_Element = new Otter.Image[COMBO_MAX]; { for ( int element = 0; element < COMBO_MAX; element++ ) { float offset = element - ( COMBO_MAX / 2 ); string elementtype = "fire"; Image_Element[element] = new Otter.Image( "../../resources/element/" + elementtype + ".png" ); // Initialize to element type { Image_Element[element].X = X; Image_Element[element].Y = Y + ( Image_Element[element].Width * ELEMENT_OFFSET * offset ); Image_Element[element].Alpha = 0; // Don't display until a combo is entered } Parent.AddGraphic( Image_Element[element] ); } } }
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; } }
// Cleanup any objects belonging solely to this wizard // IN: N/A // OUT: N/A public void Cleanup() { // Remove the wizard body sprite if ( Body != null ) { RemoveGraphic( Body ); Body = null; } }
public override void Added() { base.Added(); // Draw wizard on top of all but the HUD & particles Layer = 8 + ID; // Initialize the wizard's shader //TestShader = new Shader( "../../shaders/video.fs" ); // Initialize the position interpolation objects ClampedPosition_X.Speed = 7; ClampedPosition_Y.Speed = 7; // Initialize the position of the wizard Position = new Vector2( 0, 0 ); Destination = new Vector2( 0, 0 ); // Initialize the wizard type unique variables string wizardtypeimage = "light"; WandOffset = WAND_OFFSET; { if ( WizardType == WizardTypeStruct.WIZARD_DARK ) { wizardtypeimage = "dark"; WandOffset *= -1; WandAngleDirection *= -1; } } // Initialize the wizard's body sprite Body = new Otter.Image( "../../resources/wizard_" + wizardtypeimage + ".png" ); { Body.ScaleX = SPRITE_SCALE; Body.ScaleY = SPRITE_SCALE; Body.Angle = Angle; Body.CenterOrigin(); } // Body graphic is added later after wand // Initialize the wizard's wand sprite WandOffset *= new Vector2( Body.Width * SPRITE_SCALE, Body.Height * SPRITE_SCALE ); // Multiply offset by the size of the wizard body Wand = new Otter.Image( "../../resources/wand_" + wizardtypeimage + ".png" ); { Wand.ScaleX = SPRITE_SCALE; Wand.ScaleY = SPRITE_SCALE; Wand.Angle = Angle + WandAngle; Wand.CenterOrigin(); Wand.OriginY = Wand.Height; //Wand.Shader = TestShader; } // Add the graphics to the scene AddGraphic( Wand ); // Add wand below wizard robes AddGraphic( Body ); // Add a hitbox to the wizard int size = (int) Math.Floor( Body.Width * Body.ScaleX * HITBOX_SCALE ); SetHitbox( size, size, ( (int) ColliderType.Wizard ) + ID ); Hitbox.CenterOrigin(); // Calculate the forward & right vectors of this wizard double radangle = Math.PI * Angle / 180; double sin = Math.Sin( radangle ); double cos = Math.Cos( radangle ); Vector2 origin = new Vector2( 0, 1 ); // Default is facing upwards Forward = new Vector2( (float) ( ( (double) origin.X * cos ) - ( (double) origin.Y * sin ) ), (float) ( ( (double) origin.X * sin ) + ( (double) origin.Y * cos ) ) ); Right = new Vector2( Forward.Y, Forward.X ); // Initialize the clamped position of the wizard (for player movement) { // Calculate the side of the screen the player is on float side = Math.Sign( Forward.X ); // -1, 0, 1 float onleft = Math.Max( 0, side ); // 0 or 1 boolean number float onright = Math.Max( 0, -side ); // 0 or 1 boolean number // X float halfwidth = Body.Width * Body.ScaleX * COLLISION_SCALE; // Image is centered, ensure the whole thing stays onscreen ClampedX.Minimum = ( Game.Instance.HalfWidth * onright ) + halfwidth; ClampedX.Maximum = Game.Instance.Width - ( Game.Instance.HalfWidth * onleft ) - halfwidth; // Y float halfheight = Body.Height * Body.ScaleY * COLLISION_SCALE; // Image is centered, ensure the whole thing stays onscreen ClampedY.Minimum = halfheight; ClampedY.Maximum = Game.Instance.Height - halfheight; } // Initialize the hurt sound effects Hurt = new Sound[SOUND_HURT]; { for ( short effect = 0; effect < SOUND_HURT; effect++ ) { Hurt[effect] = new Sound( "../../resources/audio/hurt" + ( effect + 1 ) + ".wav" ); Hurt[effect].Attenuation = 0.1f; } } }
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; }
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; } }