void OnVitalChanged(VitalType v, float current)
 {
     if (v == VitalType.ShieldPoints)
     {
         _shield.fillAmount = _ship.GetVital(v).inPercent;
     }
     else if (v == VitalType.HullPoints)
     {
         _hull.fillAmount = _ship.GetVital(v).inPercent;
     }
 }
Esempio n. 2
0
 protected void SpawnShieldVFX(Vector3 shotBackwards, Vector3 hitpos, ShipEntity target)
 {
     if (target.GetVital(VitalType.ShieldPoints).current > 0f)
     {
         Object.Destroy(Object.Instantiate(ModelDB.GetShieldDeflectionVFX(), hitpos, Quaternion.LookRotation(shotBackwards), null), 3f);
     }
 }
Esempio n. 3
0
    void InitializeWorldUI()
    {
        _worldUIInstance = Instantiate(_worldUIObject, GameObject.Find("UI").transform.Find("Canvas"));
        _worldUIInstance.GetComponent <GenericTooltipHandler>().Initialize(
            OnMouseEnter,
            OnLeftClick,
            OnScrollClick,
            OnRightClick,
            OnMouseExit);

        _name = _worldUIInstance.transform.Find("name").GetComponent <Text>();

        _hull   = _worldUIInstance.transform.Find("hull").GetComponent <Image>();
        _shield = _worldUIInstance.transform.Find("shield").GetComponent <Image>();
        _hull.gameObject.SetActive(_entity.isDiscovered);
        _shield.gameObject.SetActive(_entity.isDiscovered);

        _hull.fillAmount   = _entity.GetVital(VitalType.HullPoints).inPercent;
        _shield.fillAmount = _entity.GetVital(VitalType.ShieldPoints).inPercent;

        _name.text = _entity.isDiscovered ? "'<i><color=" + (_entity.teamID == 0 ? "white" : "red") + ">" + _entity.name + "</color></i>'" : "[Unknown Signal]";
    }
Esempio n. 4
0
    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);
    }