/// <summary> /// Upgrade button click. /// Called by Unity /// </summary> public void ButtonUpClick() { if (m_thisItem.Upgrade()) { if (m_thisItem.GetType() == typeof(Science)) { m_people.MakeBoost(); GameAbstractItem itm = m_thisItem as GameAbstractItem; if (itm != null) { while (itm.m_workers > 0) { ButtonMinusClick(); } } foreach (ArrowScript asc in m_from) { asc.m_to.GetComponent <IconScript>().m_to.Remove(asc); Destroy(asc.gameObject); } foreach (ArrowScript asc in m_to) { asc.m_from.GetComponent <IconScript>().m_from.Remove(asc); Destroy(asc.gameObject); } MainScript.m_sAllItems.Remove(gameObject); MainScript.m_sIsButtonPressed = false; Destroy(gameObject); } } }
public void Draw(RenderTarget target, RenderStates states) { if (_app.Position != null) { var startPos = GetNavBarStartCoordinate(); var imagePanel = GetImagePanel(); imagePanel.Position = startPos; AbstractObject firstObject = null; if (_fieldSelected != null && _fieldSelected.ListObject.Count > 0) { firstObject = _fieldSelected.ListObject.First(); } target.Draw(imagePanel); if (_fieldSelected != null) { if (_fieldSelected.Environment != null) { var env = _fieldSelected.Environment; DisplayInfoAntQueen(target, env); DisplayInfoAntPicker(target, env); DisplayInfoAntFood(target, env); DisplayInfoAntFighter(target, env); DisplayInfoAntEgg(target, env); } else if (false == true) { } else if (firstObject != null && firstObject.GetType() == typeof(Food)) { var food = (Food)firstObject; _textCount.DisplayedString = "+" + food.GetRemaningPiece().ToString(); _imageFood.Position = new Vector2f(startPos.X + 10, startPos.Y + 10); _textCount.Position = new Vector2f(_imageFood.Position.X + _imageFood.Texture.Size.X / 2.0f - _textCount.GetGlobalBounds().Width / 2.0f, _imageFood.Position.Y + _imageFood.GetGlobalBounds().Height + 10); target.Draw(_imageFood); target.Draw(_textCount); } } } }