// Update is called once per frame void Update() { ClickDebug(); if (playing) { if (team == 1) { if (!turnQueue.active && turnQueue.Count > 0) { thisTurn = turnQueue.Pop(); thisTurn.Item1.Run(); Debug.Log("this turn: Team " + (thisTurn.Item1.TeamID) + " " + thisTurn.Item1.Position); if (isMulti && thisTurn.Item1.GetType() == typeof(MPlayer)) { Client.Instance.Send("CHR|" + thisTurn.Item2); } turnQueue.active = true; } else if (thisTurn != null && thisTurn.Item1.State == Actor.TurnState.INACTIVE) { if (thisTurn.Item1.Health > 0) { turnQueue.Add(thisTurn.Item1, thisTurn.Item2); } turnQueue.active = false; } } worldpos = Camera.main.ScreenToWorldPoint(Input.mousePosition); cellpos = grid.WorldToCell(worldpos); Actor hover = actors.SingleOrDefault(x => x.Position == cellpos && x.Health > 0); if (hover != null) { ShowProfile(true, hover); } else { ShowProfile(false); } } if (!isDebug) { int Group1 = 0; int Group2 = 0; foreach (var iActor in actors) { if (iActor.Health > 0) { if (iActor.TeamID == 1) { Group1++; } else { Group2++; } } } if (Group1 == 0 || Group2 == 0) { playing = false; winPanel.SetActive(true); if (isMulti) { winPanel.GetComponentInChildren <Text>().text = (Group2 == 0 ? teamName[0] : teamName[1]) + " Win"; } else { winPanel.GetComponentInChildren <Text>().text = (Group2 == 0 ? "Blue" : "Red") + " Win"; } } } ActorUpdate?.Invoke(); }
private void OnActorUpdate(ActorUpdate payload, Action onCompleteCallback) { ProcessActorCommand(payload.Actor.Id, payload, onCompleteCallback); }