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));
     }
 }
    void CreateGroupShipItem(Transform list, ShipEntity ship)
    {
        GameObject g = Instantiate(_groupShipItem, list);

        g.transform.Find("name").GetComponent <Text>().text = ship.name;

        Image hl = g.transform.Find("highlight").GetComponent <Image>();
        Image s  = g.transform.Find("shield").GetComponent <Image>();
        Image h  = g.transform.Find("hull").GetComponent <Image>();

        s.fillAmount = ship.GetVital(VitalType.ShieldPoints).inPercent;
        h.fillAmount = ship.GetVital(VitalType.HullPoints).inPercent;

        g.GetComponent <GenericTooltipHandler>().Initialize(
            () => TooltipManager.getInstance.OpenTooltip("[<color=yellow>LEFT-CLICK</color>] to select.\n[<color=yellow>SCROLL-CLICK</color>] to focus.", Input.mousePosition),
            () => CommandMapper.SelectShip(ship),
            () => CameraManager.getInstance.JumpTo(ship.transform.position, true),
            null,
            () => TooltipManager.getInstance.CloseTooltip());

        g.GetComponent <GroupShipUIEntity>().Initialize(hl, s, h, ship);
    }
Exemple #3
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);
        }
    }