private void CheckStable() { if (aiStable.CheckFinish() && armyList.Count < 6) { UnitTraining stableTrain = aiStable.GetComponent <UnitTraining>(); stableTrain.TrainOrder(0); } }
public void ConfigureUnitPopUp(GameObject parent, GameObject unit) { UnitTraining ut = unit.GetComponent <UnitTraining>(); _thyme.transform.GetChild(2).gameObject.GetComponent <TextMeshProUGUI>().text = ut.GetUnitThymeCost().ToString("0"); _ramen.transform.GetChild(2).gameObject.GetComponent <TextMeshProUGUI>().text = ut.GetUnitRamenCost().ToString("0"); _name.GetComponent <TextMeshProUGUI>().text = unit.GetComponent <Unit>().Name; _description.GetComponent <TextMeshProUGUI>().text = ut.GetUnitDescription(); _flavour.GetComponent <TextMeshProUGUI>().text = ut.GetUnitFlavourText(); _unitStatus.GetComponent <UiUnitStatusPopUp>().Configure(unit); Configure(parent); }
private void CheckBarrack() { Debug.Log("AI " + playerStat.GetPlayerNumber() + " build barrack."); if (aiBarrack.CheckFinish() && armyList.Count < 6) { UnitTraining barrackTrain = aiBarrack.GetComponent <UnitTraining>(); barrackTrain.TrainOrder(Random.Range(0, 3)); } Debug.Log("AI " + playerStat.GetPlayerNumber() + " find army."); UnitGroupSystem[] groupF = FindObjectsOfType <UnitGroupSystem>(); foreach (UnitGroupSystem groupDum in groupF) { if (groupDum.GetOwner() == playerStat.GetPlayerNumber() && !armyList.Contains(groupDum)) { armyList.Add(groupDum); Debug.Log("AI " + playerStat.GetPlayerNumber() + " add 1 army to group."); } } Debug.Log("AI " + playerStat.GetPlayerNumber() + " have army : " + armyList.Count); }