void Awake() { life = maxLife; GameObject spawnedLifeBar = Instantiate(lifeBarPrefab, transform.position + new Vector3(0,3f,0), lifeBarPrefab.transform.rotation) as GameObject; spawnedLifeBar.transform.parent = transform; lifeBar = spawnedLifeBar.GetComponent<DisplayBar>(); }
void Awake() { life = maxLife; GameObject spawnedLifeBar = Instantiate(lifeBarPrefab, transform.position + new Vector3(0, 3f, 0), lifeBarPrefab.transform.rotation) as GameObject; spawnedLifeBar.transform.parent = transform; lifeBar = spawnedLifeBar.GetComponent <DisplayBar>(); }
private void btn_click(object sender, EventArgs e) { if ((DisplayBar.Text == "0") || (oppered)) { DisplayBar.Clear(); } oppered = false; Button btn = (Button)sender; if (btn.Text == ".") { if (!DisplayBar.Text.Contains(".")) { DisplayBar.Text = DisplayBar.Text + btn.Text; } } else { DisplayBar.Text = DisplayBar.Text + btn.Text; } }
void Start() { hpBar = GetComponent <DisplayBar>(); hpBar.BarRectangle.width = Screen.width / 5; hpBar.BarRectangle.height = Screen.height / 10; }
public DefaultScreen(Game game) : base(string.Empty, 0) { this.game = game; particleManager = new SquareParticleManager(); Add(particleManager); const int shift = margin; // Actors actorList = new ActorList(game, new MPos(512, 11 * 512), new MPos(512, 512), "wooden") { Position = new CPos(Left + 512 + margin, 768 + shift, 0) }; Add(actorList); // Spells spellList = new SpellList(game, new MPos(512, 13 * 512), new MPos(512, 512), "stone") { Position = new CPos(Right - 512 - margin, 0, 0) }; Add(spellList); manaBar = new DisplayBar(new MPos(Width / 2 - 1536, 256), PanelCache.Types["stone"], new Color(0, 0, 255, 196)) { Position = new CPos(0, Bottom - 2048 + margin, 0) }; Add(manaBar); healthBar = new DisplayBar(new MPos(Width / 2 - 256, 512), PanelCache.Types["wooden"], new Color(255, 0, 0, 196)) { Position = new CPos(0, Bottom - 1024 + margin, 0) }; Add(healthBar); var top = Top + 512 + margin; Add(new MoneyDisplay(game) { Position = new CPos(Left + 1536 + shift, top, 0) }); Add(new HealthDisplay(game) { Position = new CPos(Left + 4096 + shift + margin, top, 0) }); if (game.ObjectiveType == ObjectiveType.FIND_EXIT) { Add(new KeyDisplay(game) { Position = new CPos(Left + 712 + shift, top + 1536 + shift + 128, 0) }); } else if (game.ObjectiveType == ObjectiveType.SURVIVE_WAVES) { Add(new WaveDisplay(game) { Position = new CPos(Left + 512 + shift, top + 1536 + shift + 128, 0) }); } var menu = new CheckBox("menu", onTicked: (t) => game.ShowScreen(ScreenType.MENU, true)) { Position = new CPos(Right - 512 - margin, Top + 512 + margin, 0), Scale = 2.5f }; Add(menu); // mission text var missionText = new UITextLine(FontManager.Header, TextOffset.MIDDLE) { Position = new CPos(0, top, 0) }; var missionContent = string.Empty; switch (game.ObjectiveType) { case ObjectiveType.FIND_EXIT: missionContent = "Search for the exit and gain access to it!"; break; case ObjectiveType.KILL_ENEMIES: missionContent = "Wipe out all enemies on the map!"; break; case ObjectiveType.SURVIVE_WAVES: missionContent = "Defend your position from incoming waves!"; break; } missionText.SetText(missionContent); if (game.Save.Level == game.Save.FinalLevel) { missionText.SetColor(Color.Blue); } else if (game.Save.Level > game.Save.FinalLevel) { missionText.SetColor(Color.Green); } Add(missionText); Add(new EnemyPointer(game)); }