public void AddHudModButton(HUD hud) { _hud = hud; Panel buttonPanel = (Panel)HudPanelField.GetValue(hud); Button helpButton; if (!buttonPanel.FindControlRecursive(out helpButton, b => b.Text == "Help")) return; Button modsButton = new Button(buttonPanel.Manager); modsButton.Init(); SkinLayer skinLayer = modsButton.Skin.Layers["Control"]; modsButton.Text = "Mods"; modsButton.Width = (int)skinLayer.Text.Font.Resource.MeasureString(modsButton.Text).X + skinLayer.ContentMargins.Horizontal + 1; modsButton.ToolTip.Text = "Show information about and settings for mods"; modsButton.Margins = new Margins(4, 4, 4, 4); modsButton.Click += ModsButtonOnClick; modsButton.Left = helpButton.Left; buttonPanel.Add(modsButton); helpButton.Left = modsButton.Left + modsButton.Width + modsButton.Margins.Right + helpButton.Margins.Left; buttonPanel.Width = helpButton.Left + helpButton.Width; buttonPanel.Left = (hud.Width - buttonPanel.Width) / 2; }
// Use this for initialization void Start() { hud = GameObject.FindGameObjectWithTag("Player").GetComponent<HUD>(); topTen = GameObject.FindGameObjectWithTag("HighScore"); hsText = topTen.GetComponent<Text>(); finish = GameObject.FindGameObjectWithTag("Finish"); fScript = finish.GetComponent<Finish>(); scoreObj = GameObject.FindGameObjectWithTag("TopTen"); hsOverlay = GameObject.Find("HSimage"); screen = GameObject.FindGameObjectWithTag("ScreenOverlay"); hsButton = GameObject.Find("HSButton").GetComponent<Button>(); tempScore = 0; hsDone = false; highScore = new int[10]; highScore[0] = 50000; highScore[1] = 25000; highScore[2] = 10000; highScore[3] = 5000; highScore[4] = 2500; highScore[5] = 1250; highScore[6] = 1000; highScore[7] = 500; highScore[8] = 125; highScore[9] = 50; }
/*** ------------------------------------------------------ ***/ /*** Game Engine methods, all can be overridden by subclass ***/ /*** ------------------------------------------------------ ***/ void Start () { hud = GetComponentInChildren< HUD >(); // Init resources AddStartResourceLimits(); AddStartResources(); }
void Awake() { sm = SimulationManager.sharedSimManager; sm.Hud = this; hud = GetComponent<HUD>(); hudView = GetComponent<HUDView>(); }
void ChangeHUD(HUD hud, Rect view, Vector3 pos, Vector2 dim) { //float width = dim.x; //float height = dim.y; foreach (Transform _trans in hud.transform) { _trans.gameObject.layer = hud.gameObject.layer; if (_trans.tag == "MainCamera") { _trans.camera.cullingMask = 1 << (9 + (hud.HudNumber-1) ); // int represents layer number // ex: 1 | 1 << (9+num); // layer 1 + layer 9 _trans.camera.rect = view; _trans.position = new Vector3((hud.HudNumber-1)*10, -10, 0); } // if (_trans.tag == "CrossHair") // { // //_trans.position = pos; // Rect inset = _trans.guiTexture.pixelInset; // _trans.guiTexture.pixelInset = new Rect (inset.x, inset.y, width, height); // } if (_trans.name == "Weapons") { foreach (Transform _t in _trans) { _t.gameObject.layer = hud.gameObject.layer; } } } GameLoaded = true; }
void Start(){ sc = GetComponent<ScoreScript> (); hud = GameObject.Find ("HUD").GetComponent<HUD>(); hud.nRecord = sc.GetRecord (); hud.nScore = sc.GetScore (); sc.ResetScore (); //zera os pontos }
public void addCamera(Camera camera, HUD hud) { SplitPair pair = new SplitPair(camera, hud); Canvas hudCanvas = hud.GetComponent<Canvas>(); hudCanvas.worldCamera = camera; if (topLeft == null) { topLeft = pair; } else if (botLeft == null) { botLeft = pair; SetOrientation(topLeft, SplitHelper.Orientation.TOP); SetOrientation(botLeft, SplitHelper.Orientation.BOTTOM); } else if (topRight == null) { topRight = pair; SetOrientation(topLeft, SplitHelper.Orientation.TOP_LEFT); SetOrientation(topRight, SplitHelper.Orientation.TOP_RIGHT); } else if (botRight == null) { botRight = pair; SetOrientation(botLeft, SplitHelper.Orientation.BOT_LEFT); SetOrientation(botRight, SplitHelper.Orientation.BOT_RIGHT); } else { Debug.Log("WARNING: Too many cameras, SplitHelper only supports 4 cameras"); } }
public void ItemCollisionTest(SoundEffects sound, HUD hud, IList<IItem> items) { Rectangle luigiRectangle = myLuigi.GetRectangle(); Rectangle itemRectangle; Rectangle intersectionRectangle; Queue<IItem> doomedItems = new Queue<IItem>(); foreach (IItem item in items) { itemRectangle = item.GetRectangle(); intersectionRectangle = Rectangle.Intersect(luigiRectangle, itemRectangle); if (!intersectionRectangle.IsEmpty) { // todo switch (item.GetItemName()) { case "Coin": //myLuigi.Coin(); hud.addCoinLuigi(); hud.increaseScoreLuigi(Constants.coinValue); hud.achievements.CoinGet(); break; case "Mushroom": sound.Powerup(); myLuigi.Mushroom(); hud.increaseScoreLuigi(Constants.mushroomValue); hud.achievements.MushroomGet(); break; case "Fireflower": sound.Powerup(); myLuigi.Fireflower(); hud.increaseScoreLuigi(Constants.fireflowerValue); hud.achievements.FlowerGet(); break; case "Oneup": sound.OneUp(); hud.extraLifeLuigi(); hud.increaseScoreLuigi(Constants.oneUpValue); break; case "Star": sound.Powerup(); myLuigi.Star(); hud.increaseScoreLuigi(Constants.starValue); hud.achievements.StarGet(); break; default: // nothing break; } doomedItems.Enqueue(item); } } while (doomedItems.Count() > 0) { IItem item = doomedItems.Dequeue(); items.Remove(item); } }
public Tuple<int, bool> EnemyCollisionTest(Luigi luigi, HUD hud, IList<IEnemy> enemies, int x, SoundEffects sound) { Rectangle luigiRectangle = myLuigi.GetRectangle(); Rectangle enemyRectangle; bool enemyKilled = false; bool invincible = myLuigi.Invincible(); int xpos = x; Rectangle intersectionRectangle; Queue<IEnemy> doomedEnemies = new Queue<IEnemy>(); foreach (IEnemy enemy in enemies) { enemyRectangle = enemy.GetRectangle(); intersectionRectangle = Rectangle.Intersect(luigiRectangle, enemyRectangle); if (!intersectionRectangle.IsEmpty) { if (intersectionRectangle.Width >= intersectionRectangle.Height) { sound.Bump(); doomedEnemies.Enqueue(enemy); hud.luigiEnemyKill(luigi); enemyKilled = true; } else if (invincible) { doomedEnemies.Enqueue(enemy); } else { myLuigi.Hit(); if (luigiRectangle.X < enemyRectangle.X) { xpos = xpos - intersectionRectangle.Width; } else { xpos = xpos + intersectionRectangle.Width; } if (myLuigi.IsDead()) { hud.lifeLostLuigi(); } } } } while (doomedEnemies.Count() > 0) { IEnemy enemie = doomedEnemies.Dequeue(); enemies.Remove(enemie); } return new Tuple<int,bool>(xpos, enemyKilled); }
void Awake() { if(mInstance == null) { mInstance = this; } UILabel[] popLabels = popUpMessage.GetComponentsInChildren<UILabel>(true); mPopUpMessageLabel = popLabels[0]; }
public void AddHUDSprite(HUD hud) { GameObject tmp = GameObject.CreatePrimitive(PrimitiveType.Plane); tmp.name = "_HUDSprite"; HUDSprite sprite = (HUDSprite)tmp.AddComponent("HUDSprite"); sprite.hud = hud; this.AddSprite(sprite); }
void Awake() { if(instance == null) { instance = this; }else{ DestroyObject(this); } }
public void Hit(IList<IItem> items, bool isMario, bool isBig, HUD hud, SoundEffects sound) { if (isBig) { sound.BreakBlock(); hud.increaseScoreMario(Constants.brokenBrickValue); GreenBrickSprite = null; } }
void Start() { hud = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<HUD>(); possessParticles = transform.FindChild("Particles_Possess").gameObject.GetComponent<ParticleSystem>(); followParticles = transform.FindChild("Particles_Follow").gameObject.GetComponent<ParticleSystem>(); possessParticles.enableEmission = false; followParticles.enableEmission = false; }
public GamePlayScreen(Game1 game) { this.game = game; hud = new HUD(); hud.Font = game.Content.Load<SpriteFont>("Arial"); LoadContent(); }
void Awake() { _Game = GameObject.Find("Game"); c_Game = _Game.GetComponent<Game>(); c_Hud = transform.parent.GetComponent<HUD>(); StartCoroutine( Init() ); }
// Use this for initialization void Start() { m_HUD = FindObjectOfType<HUD>(); m_WaveManager = FindObjectOfType<WaveManager>(); m_WaveManager.gameObject.SetActive (false); m_Player = FindObjectOfType<PlayerInput>(); }
void Start() { Player = GameObject.FindWithTag ("Player"); CheckpointPOS = Player.transform.position; //Pause_Menu = GameObject.Find("Pause_Menu"); CheckList.AddRange (GameObject.FindGameObjectsWithTag ("Checkpoint")); hudScript = GameObject.Find ("UI").GetComponent<HUD> (); CheckList = CheckList.OrderBy(go=>go.name).ToList(); LoadSaves (); }
public bool collisionCheckLaserAsteroid(BoundingSphere sphere, Spawn spawn, HUD hud) { for (int i = 0; i < spawn.asteroid.Count(); i++) if (spawn.asteroid[i].getBoundingSphere().Intersects(sphere)) { spawn.asteroid.RemoveAt(i); Boss1 bosslife; } return true; }
private void Awake() { cost = 10; PlayerData.GetInstance.myUpgradeLevel = 0; PlayerData.GetInstance.health = 100; if (instance == null) { instance = this; GameObject.DontDestroyOnLoad(this.gameObject); } else Destroy(this.gameObject); }
// Use this for initialization void Start () { currentScene = SceneManager.GetActiveScene ().name; hud = GameObject.Find ("HUD").GetComponent<HUD> (); score = GetComponent<Score> (); if (currentScene.Equals ("Game")) { player = GameObject.Find ("Player"); score.ResetScore (); } }
public bool collisionCheckLaserEnemy(BoundingSphere sphere, Spawn spawn, HUD hud) { for (int i = 0; i < spawn.enemies.Count(); i++) if (spawn.enemies[i].getBoundingSphere().Intersects(sphere)) { spawn.enemies.RemoveAt(i); killedEnemies++; } return true; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); movement = player.GetComponent<Movement>(); flash = player.GetComponent<FlashPlayer>(); squat = player.GetComponent<Squat>(); jump = player.GetComponent<Jump>(); hud = player.GetComponent<HUD>(); bounds = new Bounds(new Vector3(transform.position.x, transform.position.y, transform.position.z), new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z)); }
public IEnumerator UpdateHUD() { hud = GameObject.Find ("HUD1").GetComponent<HUD> (); player = GameObject.Find ("Hero1").GetComponent<Player> (); hud.numCoins = numCoins; hud.lives = lives; player.lives = lives; player.currentHealth = currentHealth; player.jetSet = jetSet; yield return null; }
// Use this for initialization void Start() { blocks = GameObject.FindGameObjectsWithTag("Ball"); flash = GetComponent<FlashPlayer>(); hud = GetComponent<HUD>(); movement = GetComponent<Movement>(); leftHandDif = 0.0f; rightHandDif = 0.0f; }
// Use this for initialization void Start() { hud = GetComponentInChildren< HUD >(); startMoneyLimit = 2000; startPowerLimit = 500; startMoney = 1000; startPower = 500; AddStartResourceLimits(); AddStartResources(); }
void Awake() { instance = this; timer = timer.GetComponent<Text>(); score = score.GetComponent<Text>(); foreach (Transform t in gameoverUI.transform.GetChild(1)) { playerListResult.Add(t.GetComponent<Text>()); } restartText = gameoverUI.transform.GetChild(2).GetComponent<Text>(); }
public bool collisionCheckEnemyLaserPlayer(BoundingSphere sphere, Spawn spawn, HUD hud,Player player) { for (int i = 0; i < spawn.enemies.Count(); i++) for (int j = 0; j < spawn.enemies[i].shoot1.enemyLaser.Count();j++ ) if (spawn.enemies[i].shoot1.enemyLaser[j].getBoundingSphere().Intersects(sphere)) { player.playerHealth -= 5; hud.rectangle.Width = (int)(300 * (player.playerHealth / 100)); spawn.enemies[i].shoot1.enemyLaser.RemoveAt(j); } return true; }
private void LoadDetails() { Player[] players = GameObject.FindObjectsOfType(typeof(Player)) as Player[]; foreach(Player player in players) { if(player.human) hud = player.GetComponentInChildren<HUD>(); } victoryConditions = GameObject.FindObjectsOfType(typeof(VictoryCondition)) as VictoryCondition[]; if(victoryConditions != null) { foreach(VictoryCondition victoryCondition in victoryConditions) { victoryCondition.SetPlayers(players); } } }
public override void Initialize() { // TODO: Add your initialization logic here ranks = new RankManager(); crosshair = new Crosshair(game.Content); h1 = new HUD(); d1 = new DropBoxManager(game.Content); b1 = new background(); cam = new CameraMan(new Vector2(0, 0)); cam._pos.Y += service.GraphicsDevice.PresentationParameters.BackBufferHeight / 2; cam._pos.X += service.GraphicsDevice.PresentationParameters.BackBufferWidth / 2; }
public void UpdatePlayerStatus(string serverPlayerID, long bombLeft, bool isAlive, List <object> powerupList, long playerLives) { GameObject characterObject = GameObject.Find(serverPlayerID); GameObject hud = GameObject.Find("UnityHUDPrefab"); HUD hudScript = null; // If game object can be found if (characterObject) { // If server says player is dead if (isAlive == false) { // Make camera movable (Spectator Mode) if (serverPlayerID == PlayerID.ToString()) { GameObject cameraObject = GameObject.Find("tk2dCamera"); if (cameraObject) { cameraObject.GetComponent <SmoothCamera2D>().SetTargetAlive = false; } } // Play Sound CharacterAnimController characterController = characterObject.GetComponent <CharacterAnimController>(); Destroy(characterObject); } // If the character is myself. I Toggle the powerup if (serverPlayerID == PlayerID.ToString()) { if (hud) { hudScript = hud.GetComponent <HUD>(); } // Update Lives hudScript.UpdateHealthStatus((int)playerLives); // no item - 0, 1 - bomb range, 2 - haste, 3 - invunerable, 4 - more bombs, 5 - shakable for (int powerupIndex = 0; powerupIndex < powerupList.Count; powerupIndex++) { long powerupID = (long)powerupList[powerupIndex]; //Debug.Log ("Powerup Index IS: "+powerupIndex +" ID is: "+powerupID); if (powerupIndex == 1) { hudScript.ToggleRange(powerupID != 0); } else if (powerupIndex == 2) { hudScript.ToggleHaste(powerupID != 0); } else if (powerupIndex == 3) { hudScript.ToggleInvulnerable(powerupID != 0); } else if (powerupIndex == 4) { hudScript.ToggleTrick(powerupID != 0); } else if (powerupIndex == 5) { hudScript.ToggleShake(powerupID != 0); } } } } }
public void CmdSetExp(int exp, int maxExp, int level, uint netid) { hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>(); hud.RpcSetExp(this.connectionToClient, exp, level, maxExp); }
private void HUD_onHudTargetChangedGlobal(HUD obj) { MysticsItemsRhythmHUD.RefreshForHUDInstance(obj); }
public static void RefreshForHUDInstance(HUD hudInstance) { MysticsItemsRhythmHUDUnderCrosshair.RefreshForHUDInstance(hudInstance); MysticsItemsRhythmHUDOverSkills.RefreshForHUDInstance(hudInstance); }
private void Awake() { instance = this; holes.onValueChanged.AddListener(ChangeValue); areaFactor.onValueChanged.AddListener(ChangeValueLenth); }
public override void AddScripts() { base.AddScripts(); AddDialogBoxScript.defaultPosition = new Vector2(Viewport.Width * 0.25f, Viewport.Height * 0.5f); HUD.DisableAndHideAll(); AddScript(new AddDialogBoxScript("Welcome, sir.", ScreenCentre)); AddScript(new AddDialogBoxScript("I am Lieutenant Drake and am in charge of your briefing.", ScreenCentre)); AddScript(new AddDialogBoxScript("As Commander for this sector's defence systems,\nyou must prevent ANY enemy incursion into civilian space.", ScreenCentre)); AddScript(new AddDialogBoxScript("I am bringing your sector map online now.", ScreenCentre)); AddScript(new AddDialogBoxScript("This is an interactive image of nearby space.", ScreenCentre)); AddScript(new AddDialogBoxScript("Use it to coordinate your defences\nand issue orders to your troops.", ScreenCentre)); AddScript(new MoveCameraScript(UnderSiegeGameplayScreen.CommandShip.WorldPosition + new Vector2(ScreenCentre.X * 0.5f, 0), MoveCameraStyle.LERP)); AddScript(new AddDialogBoxScript("This is your command ship,\n which we are currently on.", new Vector2(Viewport.Width * 0.75f, ScreenCentre.Y))); AddScript(new AddDialogBoxScript("Protect it at ALL costs.\nDefeat here is not an option.", new Vector2(Viewport.Width * 0.75f, ScreenCentre.Y))); AddScript(new MoveCameraScript(new Vector2(ScreenCentre.X * 0.5f, ScreenCentre.Y), MoveCameraStyle.LERP)); AddScript(new AddDialogBoxScript("Powering up your tactical overlay.")); AddScript(new AddDialogBoxScript("This will allow you to issue\ncertain instructions quickly and easily.")); AddScript(new WaitScript(2f, false)); AddScript(new AddDialogBoxScript("Overlay command stack 90% complete.", new Vector2(Viewport.Width * 0.25f, ScreenCentre.Y), false, false, false, null, 3)); AddScript(new WaitScript(2f, false)); AddScript(new AddDialogBoxScript("Overlay fully operational.\nInitialising basic interface.", new Vector2(Viewport.Width * 0.25f, ScreenCentre.Y))); AddScript(new AddDialogBoxScript("Click the 'Turrets' button when ready.", new Vector2(Viewport.Width * 0.25f, ScreenCentre.Y))); AddScript(new ShowAndActivateObjectScript(UnderSiegeGameplayScreen.HUD.GetUIObject("Buy Turrets UI"))); AddScript(new WaitForObjectSelectionScript(UnderSiegeGameplayScreen.HUD.GetUIObject("Buy Turrets UI"))); AddScript(new AddDialogBoxScript("Here, you can issue turret construction orders.\nTurrets will help fend off attackers.")); AddScript(new AddDialogBoxScript("Turrets come in three types:\nKINETIC, MISSILE and BEAM.")); AddScript(new AddDialogBoxScript("Kinetic turrets fire laser bolts\nor other projectiles.")); AddScript(new AddDialogBoxScript("They are low damage, but fast firing\nand are reliable, cheap firepower.")); AddScript(new AddDialogBoxScript("Missile turrets fire a powerful payload.")); AddScript(new AddDialogBoxScript("They take a while to fire,\nbut their damage is devastating.")); AddScript(new AddDialogBoxScript("The missiles also track their target.")); AddScript(new AddDialogBoxScript("Beam turrets focus concentrated\nenergy on an enemy.")); AddScript(new AddDialogBoxScript("They take a short time to charge,\nbut can tear through most ships.")); AddScript(new WaitScript(1.5f, false)); AddScript(new AddDialogBoxScript("Commander, a message.\nOur sensors are reporting enemy movement.")); AddScript(new AddDialogBoxScript("We must be ready for them.")); AddScript(new AddDialogBoxScript("Click any turret icon on your tactical overlay.")); AddScript(new RunEventScript(CheckTurretSelected)); AddScript(new AddDialogBoxScript("When you purchase a ship add on,\nall available hardpoints you can\nbuild on will appear on your overlay.")); AddScript(new AddDialogBoxScript("Engines can ONLY be built on yellow hardpoints.")); AddScript(new AddDialogBoxScript("Other add ons can ONLY be built on green hardpoints.")); AddScript(new AddDialogBoxScript("With the turret selected,\nclick on an available hardpoint.")); AddScript(new AddDialogBoxScript("Click on empty space to clear the selection.")); AddScript(new RunEventScript(CheckFirstTurretBought)); AddScript(new DisableAndHideObjectScript(UnderSiegeGameplayScreen.HUD.GetUIObject("Buy Turrets UI"), false)); AddScript(new AddDialogBoxScript("A construction crew has been notified.")); AddScript(new MoveCameraScript(ScreenCentre, MoveCameraStyle.Linear, 250)); AddScript(new RunEventScript(CheckEnemyScoutWaveDefeated)); AddScript(new MoveCameraScript(new Vector2(ScreenCentre.X * 0.5f, ScreenCentre.Y), MoveCameraStyle.LERP)); AddScript(new AddDialogBoxScript("A scout!")); AddScript(new AddDialogBoxScript("That means more enemies will soon be upon us.")); AddScript(new AddDialogBoxScript("I have more to brief you on sir,\nbut this is an emergency situation,\nso the rest will have to wait.")); AddScript(new AddDialogBoxScript("We should have just enough time\nto build one more turret.")); AddScript(new ShowAndActivateObjectScript(UnderSiegeGameplayScreen.HUD.GetUIObject("Buy Turrets UI"))); AddScript(new RunEventScript(CheckSecondTurretBought)); AddScript(new RunEventScript(CheckFirstWaveDefeated)); AddScript(new RunEventScript(DamageAddOnsForRepair)); AddScript(new MoveCameraScript(new Vector2(ScreenCentre.X * 0.5f, ScreenCentre.Y), MoveCameraStyle.LERP)); AddScript(new AddDialogBoxScript("We've sustained minor system damage\nto our command ship's defences.")); AddScript(new AddDialogBoxScript("On the tactical overlay, right click on an a turret.")); AddScript(new AddDialogBoxScript("This will bring up the commands that\ncan be performed on the add on.")); AddScript(new AddDialogBoxScript("Use the Repair command on all your turrets.")); AddScript(new RunEventScript(CheckTurretsRepaired)); AddScript(new AddDialogBoxScript("Turret crews reporting all repairs completed.")); AddScript(new WaitScript(1.5f, false)); AddScript(new AddDialogBoxScript("Sir, I have news from deck 13.")); AddScript(new AddDialogBoxScript("Several weeks ago we began testing\na prototype shield generator.")); AddScript(new AddDialogBoxScript("Apparently, the researchers have managed\nto finish the final integration tests\nand it is ready for construction on our station.")); AddScript(new AddDialogBoxScript("I have been told that construction orders can now be issued.")); AddScript(new AddDialogBoxScript("Updating your overlay now.")); AddScript(new WaitScript(1.0f, false)); AddScript(new ShowAndActivateObjectScript(UnderSiegeGameplayScreen.HUD.GetUIObject("Buy Shields UI"))); AddScript(new WaitScript(1.0f, false)); AddScript(new AddDialogBoxScript("Construct a shield generator.\nIt will help protect the station by absorbing damage.")); AddScript(new RunEventScript(CheckShieldConstructed)); AddScript(new WaitScript(1.0f, false)); AddScript(new AddDialogBoxScript("Sir, you need to see this.")); AddScript(new AddDialogBoxScript("I am getting readings on long range sensors.")); AddScript(new AddDialogBoxScript("Well... ONE reading.")); AddScript(new AddDialogBoxScript("It appears to be a cruiser class strike vessel.")); AddScript(new AddDialogBoxScript("You orders sir?")); AddScript(new RunEventScript(CheckForFinalWaveSpawn)); AddScript(new RunEventScript(CheckFinalWaveDefeated)); AddScript(new WaitScript(1.0f, false)); AddScript(new AddDialogBoxScript("Enemy cruiser destroyed.")); AddScript(new AddDialogBoxScript("Well done sir, I'm seeing no more\nenemy activity on long range sensors.")); AddScript(new WaitScript(2.0f)); AddScript(new RunEventScript(BackToMainMenu)); }
//private Projectile[] playerBullets; public Gameworld(ContentHolder contentHolder, Viewport view) { initializeGameworld(contentHolder); camera = new Camera(view); hud = new HUD(contentHolder, camera); }
private void Start() { _player = FindObjectOfType <Player>(); _hud = FindObjectOfType <HUD>(); }
public void Setup(HUD hud) { this.hud = hud; }
private void OnClickAcknowledgements(HUDTextButton sender, HUDButtonEventArgs e) { Remove(); HUD.AddModal(new AcknowledgementsPanel(), true); }
private void Start() { HUD = GameObject.Instantiate(HUDPrefab, HUDS.transform); HUD.GetComponent <UIFollowTarget>().target = this.transform.Find("Target").transform; HUDText = HUD.GetComponent <HUDText>(); }
void Awake() { S = this; }
public void CmdSetHealth(int health, int maxHealth, uint netid) { hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>(); hud.RpcSetHealth(this.connectionToClient, health, maxHealth); }
private void CreateHUD() { HUD hud = new HUD(player); _hudLayer.AddChild(hud); }
void Start() { hud = GameObject.FindObjectOfType <HUD> (); player = GameObject.FindObjectOfType <Player> (); EquipWeapon(currWeapon); }
public SettingsState() { _customCursor = new CustomCursor(); _mouseState = Mouse.GetState(); _hud = new SettingsHud(); }
protected override void OnPointerClick(FPoint relPositionPoint, InputState istate) { HUD.ShowToast(null, L10N.T(L10NImpl.STR_SCOREMAN_INFO_MPSCORE), 32, FlatColors.Silver, FlatColors.Foreground, 2f); }
private void Awake() { instance = this; }
private void OnClickAttributions(HUDTextButton sender, HUDButtonEventArgs e) { Remove(); HUD.AddModal(new AttributionsPanel(), true); }
public void CmdSetMaxHealth(int health, int maxHealth, uint netid) { Debug.Log("Player " + netid + " called CmdSetMaxHealth"); hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>(); hud.RpcSetMaxHealth(this.connectionToClient, health, maxHealth); }
private void OnClickUnlock(HUDTextButton sender, HUDButtonEventArgs e) { Remove(); HUD.AddModal(new UnlockPanel(), true); }
private void OnEnable() { this.TurnOff(); this.registered = false; this.outer = base.GetComponentInParent <HUD>(); }
void Awake() { _hudScript = HUD.GetComponent <HUD> (); _chrono = Chrono.GetComponent <Text> (); _timer = Timer; }
public void HUD(int startTime, int endTime, int loadingTextEndtime, string mission, string songName, string nameTag, int progressBarDelay, string avatar) { var hud = new HUD(this, startTime, endTime, loadingTextEndtime, mission, songName, nameTag, progressBarDelay, avatar); }
public void CmdSetMaxExp(int exp, int maxExp, int level, uint netid) { Debug.Log("Player " + netid + " called CmdSetMaxExp"); hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>(); hud.RpcSetMaxExp(this.connectionToClient, exp, level, maxExp); }
public override void ChangeHealth(float amount) { curHealth = Mathf.Clamp(curHealth + amount, 0, maxHealth); HUD.SetHealth(curHealth, maxHealth); }
void Awake() { globalInstance = this; }
public cAngelIsland(IServiceProvider serviceProvider, GraphicsDeviceManager graphics, int NumPerso) : base(serviceProvider, graphics) { this.NumPerso = NumPerso; Hud = new HUD(NumPerso); camera = new Camera(graphics.GraphicsDevice.Viewport); CheckPoints.Add(new Checkpoint(new Vector2(100, 360), 1)); CheckPoints.Add(new Checkpoint(new Vector2(2200, 360), 2)); CheckPoints.Add(new Checkpoint(new Vector2(4500, 650), 3)); CheckPoints.Add(new Checkpoint(new Vector2(5500, 650), 4)); Joueur = new PlayerSonic(false, true, NumPerso); Joueur.Position = GestionExterne.LoadingPosition(CheckPoints, this); TexturesObject.Add(new ObjectMapping(1, new Vector2(-130, 230))); TexturesObject.Add(new ObjectMapping(2, new Vector2(120, 230))); TexturesObject.Add(new ObjectMapping(3, new Vector2(320, 220))); TexturesObject.Add(new ObjectMapping(3, new Vector2(780, 220))); TexturesObject.Add(new ObjectMapping(2, new Vector2(1260, 230))); TexturesObject.Add(new ObjectMapping(2, new Vector2(850, -130))); BackTextures.Add(new BackGroundTexture(1, new Vector2(-350, -540))); BackTextures.Add(new BackGroundTexture(2, new Vector2(150, -520))); BackTextures.Add(new BackGroundTexture(3, new Vector2(880, -520))); BackTextures.Add(new BackGroundTexture(2, new Vector2(1560, -520))); BackTextures.Add(new BackGroundTexture(1, new Vector2(2400, -900))); BackTextures.Add(new BackGroundTexture(1, new Vector2(2100, -700))); BackTextures.Add(new BackGroundTexture(4, new Vector2(2600, -1250))); BackTextures.Add(new BackGroundTexture(3, new Vector2(3700, -850))); BackTextures.Add(new BackGroundTexture(2, new Vector2(5000, -850))); BackTextures.Add(new BackGroundTexture(1, new Vector2(6000, -500))); BackTextures.Add(new BackGroundTexture(0, new Vector2(6600, -500))); BackTextures.Add(new BackGroundTexture(1, new Vector2(6900, -500))); Teles.Add(new Tele(1, new Vector2(920, -10), NumPerso)); Rhinobots.Add(new Rhinobot(new Vector2(700, 350), 300)); Tremplins.Add(new Tremplin(new Vector2(1300, 350), false, false)); Tremplins.Add(new Tremplin(new Vector2(1300, 50), false, true)); Tremplins.Add(new Tremplin(new Vector2(1650, 50), false, true)); Rings.Add(new Ring(new Vector2(400, 350))); Rings.Add(new Ring(new Vector2(500, 350))); Rings.Add(new Ring(new Vector2(600, 350))); Rings.Add(new Ring(new Vector2(700, 350))); Rings.Add(new Ring(new Vector2(800, 350))); Rings.Add(new Ring(new Vector2(1450, 375))); Rings.Add(new Ring(new Vector2(1550, 320))); Rings.Add(new Ring(new Vector2(1850, 320))); Rings.Add(new Ring(new Vector2(1950, 375))); // ------------- Rings.Add(new Ring(new Vector2(1680, 480))); Rings.Add(new Ring(new Vector2(1680, 600))); Rings.Add(new Ring(new Vector2(1680, 720))); Rings.Add(new Ring(new Vector2(1680, 840))); //---------------------------------------------------------- TexturesObject.Add(new ObjectMapping(1, new Vector2(1800, 220))); TexturesObject.Add(new ObjectMapping(2, new Vector2(2000, 220))); TexturesObject.Add(new ObjectMapping(2, new Vector2(2200, 220))); TexturesObject.Add(new ObjectMapping(3, new Vector2(2400, 220))); Pics.Add(new Pic(new Vector2(2500, 360), false)); Pics.Add(new Pic(new Vector2(2600, 360), false)); Pics.Add(new Pic(new Vector2(2700, 360), false)); Tremplins.Add(new Tremplin(new Vector2(2850, 340), false, false)); Rings.Add(new Ring(new Vector2(2900, 300))); Rings.Add(new Ring(new Vector2(2900, 250))); Rings.Add(new Ring(new Vector2(2900, 200))); //------------------------------------------------------------- TexturesObject.Add(new ObjectMapping(3, new Vector2(3050, -200))); Tremplins.Add(new Tremplin(new Vector2(3000, 100), false, false)); Rings.Add(new Ring(new Vector2(3050, 50))); Rings.Add(new Ring(new Vector2(3050, 0))); Rings.Add(new Ring(new Vector2(3050, -50))); Teles.Add(new Tele(2, new Vector2(3250, -70), NumPerso)); Pentes.Add(new Pente(1, new Vector2(3555, -10), false)); TexturesObject.Add(new ObjectMapping(3, new Vector2(4500, -10))); Teles.Add(new Tele(3, new Vector2(4650, 100), NumPerso)); Tremplins.Add(new Tremplin(new Vector2(4800, 100), true, true)); Tremplins.Add(new Tremplin(new Vector2(5300, 100), false, true)); //----------------------------------------------------------- TexturesObject.Add(new ObjectMapping(2, new Vector2(1600, 620))); TexturesObject.Add(new ObjectMapping(3, new Vector2(1800, 620))); TexturesObject.Add(new ObjectMapping(2, new Vector2(2000, 620))); TexturesObject.Add(new ObjectMapping(1, new Vector2(2200, 620))); TexturesObject.Add(new ObjectMapping(2, new Vector2(2400, 620))); TexturesObject.Add(new ObjectMapping(3, new Vector2(2600, 620))); Tremplins.Add(new Tremplin(new Vector2(2000, 720), true, true)); Rings.Add(new Ring(new Vector2(2550, 710))); Rings.Add(new Ring(new Vector2(2600, 710))); Rings.Add(new Ring(new Vector2(2650, 710))); Rings.Add(new Ring(new Vector2(2700, 710))); Pics.Add(new Pic(new Vector2(2500, 750), false)); Pics.Add(new Pic(new Vector2(2600, 750), false)); Pentes.Add(new Pente(1, new Vector2(3110, 590), true)); Rings.Add(new Ring(new Vector2(3750, 650))); Rings.Add(new Ring(new Vector2(3800, 650))); Rings.Add(new Ring(new Vector2(3850, 650))); Rings.Add(new Ring(new Vector2(3900, 650))); //------------------------------------------------------------------- TexturesObject.Add(new ObjectMapping(2, new Vector2(4000, 510))); TexturesObject.Add(new ObjectMapping(1, new Vector2(4200, 510))); TexturesObject.Add(new ObjectMapping(3, new Vector2(4400, 510))); Teles.Add(new Tele(2, new Vector2(4400, 650), NumPerso)); Rhinobots.Add(new Rhinobot(new Vector2(4600, 650), 100)); Pics.Add(new Pic(new Vector2(4700, 650), false)); Pics.Add(new Pic(new Vector2(4800, 650), false)); //------------------------------------------------------------------- Pentes.Add(new Pente(1, new Vector2(5000, 700), true)); TexturesObject.Add(new ObjectMapping(1, new Vector2(5520, 520))); TexturesObject.Add(new ObjectMapping(2, new Vector2(5720, 520))); TexturesObject.Add(new ObjectMapping(2, new Vector2(5920, 520))); Pics.Add(new Pic(new Vector2(5750, 680), false)); Pics.Add(new Pic(new Vector2(5850, 680), false)); Singes.Add(new SingeArticuler(new Vector2(5920, 340))); Pentes.Add(new Pente(1, new Vector2(6245, 465), true)); //---------------------------------------------------------------------- TexturesObject.Add(new ObjectMapping(2, new Vector2(6775, 290))); Teles.Add(new Tele(1, new Vector2(6800, 410), NumPerso)); Pentes.Add(new Pente(1, new Vector2(7000, 470), false)); //----------------------------------------------------------------------< TexturesObject.Add(new ObjectMapping(3, new Vector2(7510, 500))); TexturesObject.Add(new ObjectMapping(3, new Vector2(7610, 500))); TexturesObject.Add(new ObjectMapping(3, new Vector2(7900, 500))); TexturesObject.Add(new ObjectMapping(2, new Vector2(8000, 500))); TexturesObject.Add(new ObjectMapping(2, new Vector2(8100, 500))); TexturesObject.Add(new ObjectMapping(3, new Vector2(8200, 500))); MiniBoss.Add(new FireBreath(new Vector2(8300, 250))); //------------------------------------------------------------------ }
public GameState1(ContentManager content, GraphicsDevice graphicsDevice, PlatformerGame game, SpriteBatch spriteBatch, int difficulty) : base(content, graphicsDevice, game, spriteBatch) { _content = content; _graphicsDevice = graphicsDevice; _game = game; _spriteBatch = spriteBatch; _content.RootDirectory = "Content"; #region Level1 #region Sprites List <Sprite> _sprites = new List <Sprite>(); Fly _fly = new Fly(_content.Load <Texture2D>("Enemies/enemies_spritesheet"), new Vector2(1150, 564), _spriteBatch, new Dictionary <string, Animation> { { "Right", new Animation(_content.Load <Texture2D>("Enemies/enemies_spritesheet"), 2, new List <Rectangle> { new Rectangle(0, 32, 72, 36), new Rectangle(0, 0, 75, 31) } ) }, { "Left", new Animation(_content.Load <Texture2D>("Enemies/enemies_spritesheet_mirrored"), 2, new List <Rectangle> { new Rectangle(281, 32, 72, 36), new Rectangle(276, 0, 75, 31) } ) }, }); Fly _fly2 = new Fly(_content.Load <Texture2D>("Enemies/enemies_spritesheet"), new Vector2(4200, 700), _spriteBatch, new Dictionary <string, Animation> { { "Right", new Animation(_content.Load <Texture2D>("Enemies/enemies_spritesheet"), 2, new List <Rectangle> { new Rectangle(0, 32, 72, 36), new Rectangle(0, 0, 75, 31) } ) }, { "Left", new Animation(_content.Load <Texture2D>("Enemies/enemies_spritesheet_mirrored"), 2, new List <Rectangle> { new Rectangle(281, 32, 72, 36), new Rectangle(276, 0, 75, 31) } ) }, }); Player _player = new Player(_content.Load <Texture2D>("Player/p3_spritesheet"), new Vector2(100, 600), _spriteBatch, new Dictionary <string, Animation> { { "WalkRight", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet"), 11, new List <Rectangle> { new Rectangle(0, 0, 72, 97), new Rectangle(73, 0, 72, 97), new Rectangle(146, 0, 72, 97), new Rectangle(0, 98, 72, 97), new Rectangle(73, 98, 72, 97), new Rectangle(146, 98, 72, 97), new Rectangle(219, 0, 72, 97), new Rectangle(292, 0, 72, 97), new Rectangle(219, 98, 72, 97), new Rectangle(365, 0, 72, 97), new Rectangle(292, 98, 72, 97), }) }, { "WalkLeft", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet_mirrored"), 11, new List <Rectangle> { new Rectangle(508 - 72, 0, 72, 97), new Rectangle(508 - 73 - 72, 0, 72, 97), new Rectangle(508 - 146 - 72, 0, 72, 97), new Rectangle(508 - 0 - 72, 98, 72, 97), new Rectangle(508 - 73 - 72, 98, 72, 97), new Rectangle(508 - 146 - 72, 98, 72, 97), new Rectangle(508 - 219 - 72, 0, 72, 97), new Rectangle(508 - 292 - 72, 0, 72, 97), new Rectangle(508 - 219 - 72, 98, 72, 97), new Rectangle(508 - 365 - 72, 0, 72, 97), new Rectangle(508 - 292 - 72, 98, 72, 97), } ) }, { "StandRight", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet"), 1, new List <Rectangle> { new Rectangle(67, 196, 72, 97) }) }, { "StandLeft", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet_mirrored"), 1, new List <Rectangle> { new Rectangle(508 - 67 - 72, 196, 72, 97) } ) }, { "JumpRight", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet"), 1, new List <Rectangle> { new Rectangle(438, 93, 72, 97) } ) }, { "JumpLeft", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet_mirrored"), 1, new List <Rectangle> { new Rectangle(508 - 438 - 72, 93, 72, 97) } ) }, { "HurtRight", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet"), 1, new List <Rectangle> { new Rectangle(438, 0, 69, 92) } ) }, { "HurtLeft", new Animation(_content.Load <Texture2D>("Player/p3_spritesheet_mirrored"), 1, new List <Rectangle> { new Rectangle(508 - 438 - 69, 0, 69, 92) } ) }, }); _sprites.Add(_player); _sprites.Add(_fly); _sprites.Add(_fly2); #endregion #region LoadMap XmlDocument _tileSet = new XmlDocument(); XmlDocument _mapFile = new XmlDocument(); _mapFile.Load("../../../../Content/Maps/Level1.tmx"); _tileSet.Load("../../../../Content/Maps/TileSetLevel1.tsx"); string[] _tileTextureSources = XmlParser.ToTextureArray(_tileSet); Texture2D[] _tileTextures = new Texture2D[_tileTextureSources.Length]; //Source dictionary omzetten naar een texture array : (int,string) --> (int,Texture2d) for (int i = 0; i < _tileTextureSources.Length; i++) { _tileTextures[i] = _content.Load <Texture2D>("Tiles/" + _tileTextureSources[i]); } int[] nonCollideTiles = { 14, 15, 16, 17, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 42, 43, 44, 45, 46, 47, 48, 49 }; int _coinTile = 40; int[] _bridgeTiles = { 5 }; int[] _killTiles = { 20, 21 }; UserMadeBoard _userMadeBoard = new UserMadeBoard(_mapFile, _tileTextures, _spriteBatch, _sprites, nonCollideTiles, _coinTile, _bridgeTiles, _killTiles); #endregion #region Camera&Hud Camera _camera = new Camera(_player); HUD _HUD = new HUD( new Dictionary <string, Texture2D> { { "FullHeart", _content.Load <Texture2D>("HUD/hud_heartFull") }, { "HalfHeart", _content.Load <Texture2D>("HUD/hud_heartHalf") }, { "Coin", _content.Load <Texture2D>("HUD/hud_coins") }, { "Cross", _content.Load <Texture2D>("HUD/hud_x") }, { "1", _content.Load <Texture2D>("HUD/hud_1") }, { "2", _content.Load <Texture2D>("HUD/hud_2") }, { "3", _content.Load <Texture2D>("HUD/hud_3") }, { "4", _content.Load <Texture2D>("HUD/hud_4") }, { "5", _content.Load <Texture2D>("HUD/hud_5") }, { "6", _content.Load <Texture2D>("HUD/hud_6") }, { "7", _content.Load <Texture2D>("HUD/hud_7") }, { "8", _content.Load <Texture2D>("HUD/hud_8") }, { "9", _content.Load <Texture2D>("HUD/hud_9") }, { "0", _content.Load <Texture2D>("HUD/hud_0") }, }, _spriteBatch, _player, _camera); #endregion #endregion levels = new List <Level> { new Level(_spriteBatch, _game, _userMadeBoard, _sprites, _HUD), }; levelManager = new LevelManager(levels, difficulty, _content, _graphicsDevice, _spriteBatch, _game); }
private void Start() { ammo = weaponInfo.clipSize; fireMode = weaponInfo.fireMode; HUD.SetAmmoText(ammo, weaponInfo.clipSize); }