void PrepareArmies() { armies.Sort(delegate(CombatMonsterGroup a, CombatMonsterGroup b) { if (a.initiative > b.initiative) { return(-1); } if (b.initiative < a.initiative) { return(1); } return(0); }); for (int i = 0; i < armies.Count; i++) { TimelineTurn turn = Instantiate(timelineTurnPrefab, timeline.transform); turn.group = armies[i]; armies[i].armyId = i; turn.combatGroupId = i; turn.GetComponentInChildren <Text>().text = armies[i].count.ToString(); if (turn.group.playerId == 0) { turn.GetComponentInChildren <Text>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f); turn.GetComponentInChildren <Outline>().effectColor = new Color(0.0f, 0.0f, 0.0f, 0.5f); } else { turn.GetComponentInChildren <Text>().color = new Color(0.0f, 0.0f, 0.0f, 1.0f); turn.GetComponentInChildren <Outline>().effectColor = new Color(1.0f, 1.0f, 1.0f, 0.5f); } } }
void UpdateTimelineItem(CombatMonsterGroup group) { TimelineTurn turn = GetTimelineItem(group.armyId); if (!turn) { Debug.Log("No turn found for this army."); return; } turn.GetComponentInChildren <Text>().text = group.count.ToString(); if (group.dead) { turn.GetComponentInChildren <Image>().color = new Color(1.0f, 0.0f, 0.0f, 1.0f); } }