Example #1
0
    private void Awake()
    {
        retracting = false;
        line       = GetComponent <LineRenderer>();
        hoseBox    = FindObjectOfType <HoseBox>();

        anchorPoint = hoseBox.transform.position;
        linePoints  = new List <Vector3>();
        linePoints.Add(anchorPoint);
    }
    private void Update()
    {
        transform.forward = Camera.main.transform.forward;

        if ((!item.getActionLock() && item.GetPlayerList().Any()) || item.GetBeingCarried())
        {
            canvas.enabled = true;
        }
        else
        {
            canvas.enabled = false;
        }

        if (!item.GetBeingCarried() && item.IsCarriable())
        {
            text.text = "PICK UP";

            if (item.GetPickUp().timeCurrent > 0)
            {
                fill.fillAmount = 1 - (item.GetPickUp().getRemainingTime() / item.pickupTime);
            }
            else
            {
                fill.fillAmount = 0;
            }
        }
        else if (!item.IsCarriable() && item.getActionTask().time > 0 && !item.getActionTask().IsComplete() && !item.getActionLock())
        {
            bool on = false;
            //Hose Box
            if (item.CompareTag("Hose Box"))
            {
                HoseBox hb = (HoseBox)item;
                on = hb.getHoseRef().getWaterJet().isPlaying;
            }

            text.text = (on)?   "TURN OFF" : "TURN ON";

            if (item.getActionTask().timeCurrent > 0)
            {
                fill.fillAmount = 1 - (item.getActionTask().getRemainingTime() / item.actionTime);
            }
            else
            {
                fill.fillAmount = 0;
            }
        }
        else if (item.GetBeingCarried())
        {
            text.text       = "DROP";
            fill.fillAmount = 0;
        }
    }