public override bool RemoveAgent(HexSpaceReservationAgent agent) { if (agent is null) { throw new ArgumentNullException(nameof(agent)); } if (!spaceReservationAgents.Remove(agent)) { return(false); } agent.GotFocus -= HexSpaceReservationAgent_GotFocus; agent.LostFocus -= HexSpaceReservationAgent_LostFocus; agent.Hide(); AgentChanged?.Invoke(this, new HexSpaceReservationAgentChangedEventArgs(agent, null)); UpdateAggregateFocus(); wpfHexView.QueueSpaceReservationStackRefresh(); return(true); }
public override void AddAgent(HexSpaceReservationAgent agent) { if (wpfHexView.IsClosed) { throw new InvalidOperationException(); } if (agent is null) { throw new ArgumentNullException(nameof(agent)); } if (spaceReservationAgents.Contains(agent)) { throw new InvalidOperationException(); } spaceReservationAgents.Add(agent); agent.GotFocus += HexSpaceReservationAgent_GotFocus; agent.LostFocus += HexSpaceReservationAgent_LostFocus; AgentChanged?.Invoke(this, new HexSpaceReservationAgentChangedEventArgs(null, agent)); UpdateAggregateFocus(); wpfHexView.QueueSpaceReservationStackRefresh(); }
private void ActiveAgentChanged(GameObject agent) { AgentChanged?.Invoke(agent); }