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();
    }
示例#2
0
    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);
        }
    }
示例#3
0
 void OnLeftClick()
 {
     if (_entity.teamID == 0)
     {
         CommandMapper.SelectShip(_entity, Input.GetKey(KeyCode.LeftShift), Input.GetKey(KeyCode.LeftControl));
     }
     else
     {
         CommandMapper.AddMove(_entity.transform.position, !Input.GetKey(KeyCode.LeftShift));
     }
 }
示例#4
0
    void ProcessPrimaryKey()
    {
        Vector3    p  = GetClickedPosition();
        GameObject g  = GetClickedObject();
        ShipEntity se = GetClickedShip(g);

        //if we leftclicked on a ship
        if (se != null)
        {
            //if its player-owned
            if (se.teamID == 0)
            {
                CommandMapper.SelectShip(se, _shiftModifier, _controlModifier);
            }
            else
            {
                CommandMapper.UpdateTarget(se);
            }
        }
        else
        {
            CommandMapper.AddMove(p, !_shiftModifier);
        }
    }