public void Add(AgentRemote remote) { SelectableAgentElement el = selectablePooling.GetItem(); el.PlaceholderComp.Text = remote.AgentID.ToString(); el.SelectableComp.OnClickEvents += delegate { OnSelected(remote); }; el.gameObject.SetActive(true); el.RectTransform.SetAsLastSibling(); Catcher.Add(el); }
private void SetupBuildingIcon() { List <Vector3Int> constructPositions = ConstructNodeManager.Centers; for (int i = 0; i < constructPositions.Count; i++) { Vector3Int serPos = constructPositions[i].ToSerPosition(); Vector3 position = ToLocalFrom(serPos); ConstructIcon icon = iconPooling.GetItem(); icon.SetHoldingPositions(ConstructNodeManager, serPos); icon.transform.localPosition = position; Catcher.Add(icon); icon.gameObject.SetActive(true); } }
public void Create(UnitRow unitData, UserInfoRow user) { AgentRemote agentRemote = AgentPooling.GetItem(unitData.ID_Unit); if (agentRemote == null || user == null) { return; } else { agentRemote.Dispose(); this.AddAgent(unitData.ID, agentRemote); LightweightLabel label = labelPooling.GetItem(); agentRemote.transform.position = MapIns.CellToWorld(unitData.Position_Cell.Parse3Int().ToClientPosition()); agentRemote.OnDead += delegate { AgentPooling.Release(agentRemote.Type, agentRemote); labelPooling.Release(label); MyAgentRemoteManager.Remove(agentRemote.AgentID); this.RemoveAgent(agentRemote.AgentID); }; label.Initalize(agentRemote, MainCamera); bool isOwner = unitData.ID_User == PlayerInfo.Info.ID_User; agentRemote.Initalize(UnitTable, label, unitData, user, isOwner); if (isOwner) { if (agentRemote.NavAgent == null) { agentRemote.gameObject.AddComponent <NavAgent>(); } MyAgentRemoteManager.Add(agentRemote); agentRemote.name = "Owner " + unitData.ID; } else { agentRemote.name = "other " + unitData.ID; } agentRemote.gameObject.SetActive(true); } }