void OnInitialize() { _uiItem = Instantiate(_uiPrefab, WorldUIManager.getInstance.canvas); _uiItem.transform.Find("text").GetComponent <Text>().text = "[Unknown Signal]"; _uiItem.GetComponent <GenericTooltipHandler>().Initialize( null, //should bring up tooltip delegate { CommandMapper.AddMove(_entity.transform.position, !Input.GetKey(KeyCode.LeftShift)); if (_isDiscovered) { CommandMapper.SetResourceTarget(_entity); } }, delegate { if (Input.GetKey(KeyCode.LeftAlt)) { CommandMapper.SetAlignmentPlane(_entity.transform.position.y); } else { CameraManager.getInstance.JumpTo(_entity.transform.position, true); } }, null, null); //should kill tooltip InitializeAlignmentVisualization(); }
public void CreateContactItem(string text, string tooltip, Vector3 position, float lifetime = -1f) { GameObject g = Instantiate(_contactItem, _canvas); g.transform.position = _camera.WorldToScreenPoint(position); g.GetComponentInChildren <Text>().text = text; g.GetComponent <GenericTooltipHandler>().Initialize( () => TooltipManager.getInstance.OpenTooltip(tooltip, Input.mousePosition), //should bring up tooltip () => CommandMapper.AddMove(position, !Input.GetKey(KeyCode.LeftShift)), delegate { if (Input.GetKey(KeyCode.LeftAlt)) { CommandMapper.SetAlignmentPlane(position.y); } else { CameraManager.getInstance.JumpTo(position, true); } }, null, () => TooltipManager.getInstance.CloseTooltip()); //should kill tooltip _contactItems.Add(new ContactItem(g, position)); if (lifetime > 0f) { Destroy(g, lifetime); } }
void OnScrollClick() { if (Input.GetKey(KeyCode.LeftAlt)) { CommandMapper.SetAlignmentPlane(_entity.transform.position.y); } else { CameraManager.getInstance.JumpTo(_entity.transform.position, true); } }