private void ButtonControl(UISelectionDescription information) { actionTypes action = information.GetActionType(); if (action == actionTypes.Build || action == actionTypes.Spawn) { SetButtonColorAndActiveStatus(buildButton, true); SetButtonColorAndActiveStatus(evolveButton, false); SetButtonColorAndActiveStatus(researchButton, false); BuildButtonDisplayControl(information); } if (action == actionTypes.Evolve) { SetButtonColorAndActiveStatus(buildButton, false); SetButtonColorAndActiveStatus(evolveButton, true); SetButtonColorAndActiveStatus(researchButton, false); EvolveButtonDisplayControl(information); } if (action == actionTypes.Research) { SetButtonColorAndActiveStatus(buildButton, false); SetButtonColorAndActiveStatus(evolveButton, false); SetButtonColorAndActiveStatus(researchButton, true); } if (action == actionTypes.None) { SetButtonColorAndActiveStatus(buildButton, false); SetButtonColorAndActiveStatus(evolveButton, false); SetButtonColorAndActiveStatus(researchButton, false); } }
private void EvolveButtonDisplayControl(UISelectionDescription information) { evolveButton.onClick.RemoveAllListeners(); if (isEvolving) { Tower newEvo = information.GetComponent <Tower>(); evolveButton.onClick.AddListener(delegate { towerEvolving.Evolve(newEvo); }); } }
private void CheckForUpgradeCenter(UISelectionDescription uISDtoSwitch) { if (uISDtoSwitch.GetBuildingType() == buildingTypes.UpgradeCenter) { if (FindObjectOfType <UpgradeCenter>()) { selected = FindObjectOfType <UpgradeCenter>().GetComponent <UISelectionDescription>(); } } }
private void DisplayType(UISelectionDescription information) { if (information.GetMyType() == evoTypes.None) { selectedTypeRef.text = "Building"; } else { selectedTypeRef.text = information.GetMyType().ToString(); } }
private void BuildButtonDisplayControl(UISelectionDescription information) { if (information.GetActionType() == actionTypes.Build) { buildButton.onClick.AddListener(Build); buildingToBuild = information.GetBuildingPrefab(); BuildingSpawner spawner = FindObjectOfType <BuildingSpawner>(); } if (information.GetActionType() == actionTypes.Spawn) { buildButton.onClick.AddListener(Spawn); } }
private void DisplayCost(UISelectionDescription information) { if (information.GetActionType() == actionTypes.Build) { costTextRef.text = $"Build \nCost - {information.GetBuildCost()}"; } else if (information.GetActionType() == actionTypes.Spawn) { costTextRef.text = $"Spawn"; } else { costTextRef.text = $"Build"; } }
public void UpdateSelectionInformation(UISelectionDescription information) { DisplayType(information); selectedNameRef.text = information.GetMyName(); selectedImageRef.sprite = information.GetMyImage(); statisticTextRef.text = information.GetMyStatistics(); descriptiveTextRef.text = information.GetMyDescription(); DisplayCost(information); ButtonControl(information); if (selected.GetComponent <Tower>() && !isEvolving) { evolutionMenu.SetButtons(selected); } lastSelected = selected; }
public void SetSelected(UISelectionDescription newSelected, bool evolutionSelected) { if (!evolutionSelected) { FindObjectOfType <UISliderControl>().ForceCloseMenus(); isEvolving = false; } selected = newSelected; if (selected == null) { SetEnableSelectionUI(false); lastSelected = null; return; } PostBuildingRedirect(selected); SetEnableSelectionUI(true); }
private void PostBuildingRedirect(UISelectionDescription uISDtoSwitch) { CheckForResearchCenter(uISDtoSwitch); CheckForUpgradeCenter(uISDtoSwitch); CheckForEnemyBreeder(uISDtoSwitch); }