private void RemoveButton(StandardRobot r) { if (!_robotButtons.ContainsKey(r)) { return; } var button = _robotButtons[r]; Destroy(button); }
private void Select(StandardRobot robot) { foreach (var r in _robots) { r.GetComponent <Hackable>().IsControlled = r == robot; } foreach (var t in _terminals) { t.GetComponent <Hackable>().IsControlled = false; } }
private void AddButton(StandardRobot r) { if (_robotButtons.ContainsKey(r)) { return; } _robotButtons[r] = Instantiate(ButtonPrefab); var button = _robotButtons[r].GetComponent <HackableItemButton>(); var buttonRect = _robotButtons[r].GetComponent <RectTransform>(); button.ConnectedItem = r.GetComponent <Hackable>(); buttonRect.SetParent(robotButtonList); button.ButtonPressed += (gameObject) => Select(r); }