Esempio n. 1
0
        private void RemoveButton(StandardRobot r)
        {
            if (!_robotButtons.ContainsKey(r))
            {
                return;
            }

            var button = _robotButtons[r];

            Destroy(button);
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        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);
        }