void treeAdd() { if (tree = true) { ResourceUI.treeAddGPoints(points); } }
/** * <summary> * Select a given resource * </summary> * * <param name="resource">resource</param> * * <returns> * void * </returns> */ public static void SelectResource(GameObject resource) { ResourcesManagerBehaviour.UnselectResource(); // Unselect units if (UnitsManagerBehaviour.SelectedUnits != null) { UnitsManagerBehaviour.UnselectGameObjects(); } ResourceBehaviour resourceBehaviour = resource.GetComponent <ResourceBehaviour>(); //resourceBehaviour.SetSelect(true); // Show info component panel Self.infoComponentPanel.SetActive(true); Self.infoComponentPanel .transform .Find("Single") .gameObject .SetActive(true); ResourceUI resourceUI = resourceBehaviour.GetUI() .GetComponent <ResourceUI>(); InfoComponentPanelUI infoComponentPanelUI = Self.infoComponentPanel.GetComponent <InfoComponentPanelUI>(); infoComponentPanelUI.SetName(resource.name); infoComponentPanelUI.SetHealth(resourceBehaviour.GetHealth(), resourceBehaviour.GetMaxHealth()); infoComponentPanelUI.SetIcon(resourceUI.GetIcon()); // Set selected resource ResourcesManagerBehaviour.SelectedResource = resource; }
// Use this for initialization void Start() { RayInfo = GameObject.Find("Husband").gameObject.GetComponent <RayInteraction>(); RootGauge_MS = GameObject.Find("UI").gameObject.GetComponent <UIRootingSlider>(); resourcel = GameObject.Find("NumUIPrefab").gameObject.GetComponent <ResourceUI>(); Gen = GameObject.Find("UI").gameObject.GetComponent <UIGeneral>(); RootInfo = GameObject.Find("RootingImage").gameObject.GetComponent <UIRootingInfo>(); RMoney[0] = new Money(20000, false); // Kitchen_Table(1-0) RMoney[1] = new Money(20000, false); // Fridge(1-0) RMoney[2] = new Money(30000, false); // D_Table(1-0) RMoney[3] = new Money(30000, false); // TV_Stand(1-0) RMoney[4] = new Money(30000, false); // K-Table(1-0-1) RMoney[5] = new Money(20000, false); // K-Table(1-0-2) RMoney[6] = new Money(30000, false); // Sofa(1-0-1) RMoney[7] = new Money(30000, false); // Sofa(1-0-2) RMoney[8] = new Money(100000, false); // Washer(1-1) RMoney[9] = new Money(10000, false); // Closet(1-2) RMoney[10] = new Money(10000, false); // Desk(1-2) RMoney[11] = new Money(10000, false); // Washstand(1-3) RMoney[12] = new Money(10000, false); // Toilet(1-3) RMoney[13] = new Money(10000, false); // Closet(2-1) RMoney[14] = new Money(20000, false); // Desk(2-1) RMoney[15] = new Money(20000, false); // TV_Stand(2-1) RMoney[16] = new Money(10000, false); // Bed(2-1) RMoney[17] = new Money(30000, false); // Closet(2-3) RMoney[18] = new Money(10000, false); // Desk(2-3) RMoney[19] = new Money(10000, false); // Bed(2-3) RMoney[20] = new Money(10000, false); // Toilet(2-4) RMoney[21] = new Money(10000, false); // Washstand(2-4) }
void Start() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); yearlyEvents = GameObject.FindGameObjectWithTag("GameManager").GetComponent <YearlyEvents>(); cameraMove = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>(); statsUI = GetComponent <StatsUI>(); resourceUI = GetComponent <ResourceUI>(); }
public void Init(Unit unit) { this.unit = unit; resourceUI = Instantiate(resourcePrefab, Vector3.zero, Quaternion.identity, transform); resourceUI.gameObject.name = unit.CarriedResourceType.ToString() + "_Resource"; resourceUI.gameObject.SetActive(false); resourceUI.Init(); }
void showLimitIncreace(int lastRound, int thisRound) { int roundInd = thisRound - 1; ResourceUI rui = FindObjectOfType <ResourceUI>(); rui.setLimitIncrease(roundInd < maxSpendLimit.Length ? maxSpendLimit[roundInd] : false); rui.setMaxIncrease(roundInd < maxCapacity.Length ? maxCapacity[roundInd] : false); }
/** * <summary> * Set health * </summary> * * <param name="health">Health</param> * * <returns> * void * </returns> */ public void SetHealth(float health) { this.health = health; ResourceUI resourceUI = this.UI.GetComponent <ResourceUI>(); resourceUI.SetHealth(health, this.maxHealth); }
void Start() { ThisTr = this.gameObject.GetComponent <Transform>(); SearchPos = ThisTr; resourcel = GameObject.Find("NumUIPrefab").gameObject.GetComponent <ResourceUI>(); Money = GameObject.Find("Husband").gameObject.GetComponent <MoneySystem>(); WifeInfo = GameObject.Find("Wife").gameObject.GetComponent <Wife>(); Hit_motion = GameObject.Find("UI/Hit_Montion").gameObject.GetComponent <HitMontion>(); }
void Update() { if (currentHealth <= 0) { currentHealth = 0; ResourceUI.AddBPoints(points); Destroy(gameObject); } }
private void Start() { wfs = new WaitForSeconds(timeToReduceOxygen); resourceManager = ResourceManagement.instance; resourceUI = ResourceUI.instance; StartCoroutine(reduceOxygen()); }
/** * <summary> * Set max health * </summary> * * <param name="maxHealth">maxHealth</param> * * <returns> * void * </returns> */ public void SetMaxHealth(float maxHealth) { float currentHealth = this.GetHealth(); this.maxHealth = maxHealth; ResourceUI resourceUI = this.UI.GetComponent <ResourceUI>(); resourceUI.SetMaxHealth(currentHealth, maxHealth); }
private void AddResourceLabel(KeyValuePair <ResourceTypes, int> resource) { ResourceUI resourceUI = Instantiate(resourcePrefab, transform, false); resourceUI.transform.localPosition += new Vector3(0, offsetY, 0); offsetY += 30.0f; resourceUI.gameObject.SetActive(true); resourceUI.Init(); resourceLabels.Add(resource.Key, resourceUI); }
private void SetResourceUI(GameObject obj, ResourceType type) { ResourceUI resourceUI = obj.GetComponent <ResourceUI>(); if (resourceUI == null) { Debug.LogError("Prefab for type " + type + " did not have ResourceUI component"); return; } resourceUI.SetResource(type); }
private void Awake() { #region Maintain single entity if (instance == null) { instance = this; } else { Destroy(gameObject); } #endregion }
// Use this for initialization void Start() { //Initialize all the variables if (!(world == null || menu == null || userui == null || grid == null)) { return; } if (GetComponent <MenuScript>() == null) { menu = gameObject.AddComponent <MenuScript>(); } if (GetComponent <UserUI>() == null) { userui = gameObject.AddComponent <UserUI>(); } if (GetComponent <ResourceUI>() == null) { resourceui = gameObject.AddComponent <ResourceUI>(); } if (GetComponent <Builder>() == null) { builder = gameObject.AddComponent <Builder>(); } if (GetComponent <ClickScript>() == null) { click = gameObject.AddComponent <ClickScript>(); } if (grid == null) { grid = FindObjectOfType <CameraScript>() != null?FindObjectOfType <CameraScript>().overlay : null; } if (world == null) { world = FindObjectOfType <World>(); } if (camera == null) { camera = Camera.main; } #if UNITY_ANDROID if (camerascript == null) { camerascript = FindObjectOfType <CameraScript>(); } #endif }
/** * <summary> * Refresh or update the selected resource information * </summary> * * <returns> * void * </returns> */ public static void UpdateSelectedResourceInfo() { if (!ResourcesManagerBehaviour.SelectedResource) { return; } ResourceBehaviour resourceBehaviour = ResourcesManagerBehaviour.SelectedResource .GetComponent <ResourceBehaviour>(); ResourceUI resourceUI = resourceBehaviour.GetUI() .GetComponent <ResourceUI>(); InfoComponentPanelUI infoComponentPanelUI = Self.infoComponentPanel.GetComponent <InfoComponentPanelUI>(); infoComponentPanelUI.SetName(ResourcesManagerBehaviour.SelectedResource.name); infoComponentPanelUI.SetHealth(resourceBehaviour.GetHealth(), resourceBehaviour.GetMaxHealth()); infoComponentPanelUI.SetIcon(resourceUI.GetIcon()); }
void Start() { //Only one resource manager can exist if (instance != null) { Destroy(instance); } instance = this; resourceUI = GetComponent <ResourceUI>(); resourceAmount = new int[4]; resourceBaseIncome = new int[3]; resourceUpkeep = new int[3]; //Setup the process income function to run every tick InvokeRepeating("processIncome", tick, tick); //REPACE WITH COROUTINE }
void Start() { if (DataHandler.hasLoadedFile() && !Menu.newGame) { DataHandler.load(this); } else { warStatus.Add(Kingdom.Cobeth, false); warStatus.Add(Kingdom.Jalonn, false); warStatus.Add(Kingdom.Galerd, false); warStatus.Add(Kingdom.Rym, false); conqueredStatus.Add(Kingdom.Cobeth, false); conqueredStatus.Add(Kingdom.Jalonn, false); conqueredStatus.Add(Kingdom.Galerd, false); conqueredStatus.Add(Kingdom.Rym, false); } allGoods.Add(rymGoodPrices); allGoods.Add(jalonnGoodPrices); allGoods.Add(galerdGoodPrices); allGoods.Add(cobethGoodPrices); tradeObjects.Add(cobethTrade); tradeObjects.Add(jalonnTrade); tradeObjects.Add(rymTrade); tradeObjects.Add(galerdTrade); originalTrades = tradesLeft; originalSeconds = secondsBetweenYears; statsUI = canvas.GetComponent <StatsUI>(); resourceUI = canvas.GetComponent <ResourceUI>(); cameraMove = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>(); generateGoodPrices(); }
private void Start() { UI = GetGameObjectInRoot("Canvas").GetComponent <ResourceUI>(); UpdateUI(); }
private void Start() { resourceUI = ResourceUI.instance; }