private static string GetLabelText(DuelOutcome data) { string colorCode = "FFB932"; string lineAComponent = data.FirstSurvives ? (" -> " + data.RemainingHealth) : " (killed)"; string lineBComponent = data.FirstSurvives ? " (killed)" : (" -> " + data.RemainingHealth); string lineA = string.Format("First Target:\t\t<color=#{0}>{1}</color>{2}", colorCode, data.SecondTargetHealth, lineAComponent); string lineB = string.Format("Second Target:\t<color=#{0}>{1}</color>{2}", colorCode, data.FirstTargetHealth, lineBComponent); string lineC = string.Format("Damage:\t\t<color=#{0}>{1}</color>", colorCode, data.Damage); return(string.Format("{0}\n{1}\n{2}", lineA, lineB, lineC)); }
void Start() { DuelOutcome outcomeA = DuelResolve.GetOutcome(40, 5); DuelOutcome outcomeB = DuelResolve.GetOutcome(5, 40); _tables = DuelResolve.GetResolvesTable(); _itemBehaviors = MakeBoxes(); MakeLabels(); Material labelMaterial = new Material(SelectedLabel.fontMaterial); labelMaterial.SetInt("unity_GUIZTestMode", 0); SelectedLabel.fontMaterial = labelMaterial; labelMaterial.renderQueue = 5001; }
private ItemBehavior CreateItem(DuelOutcome item) { Material newMat = new Material(Mat); GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube); obj.name = item.SecondTargetHealth + " duels " + item.FirstTargetHealth + " doing " + item.Damage + " damage"; obj.transform.parent = transform; obj.GetComponent <MeshRenderer>().sharedMaterial = newMat; ItemBehavior behavior = obj.AddComponent <ItemBehavior>(); behavior.Data = item; behavior.Mat = newMat; behavior.Main = this; return(behavior); }
private ItemBehavior[,] MakeBoxes() { ItemBehavior[,] ret = new ItemBehavior[DuelResolve.Range, DuelResolve.Range]; for (int i = 0; i < DuelResolve.Range; i++) { DuelResolve row = _tables[i]; for (int j = 0; j < DuelResolve.Range; j++) { DuelOutcome item = row.Outcomes[j]; ItemBehavior behavior = CreateItem(item); ret[i, j] = behavior; } } return(ret); }