private void Update()
    {
        /* THIS WHOLE THING PROBABLY NEEDS REWRITING */
        // Based on how we will handle the UI for the objects, this might need rewriting.
        // Creating a separate script for the UI elements might be more beneficial, keeping this one more tidy.

        if (moveItem && Input.GetMouseButton(0))
        {
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0.0f;

            transform.position = mousePos;
        }

        if (moveItem && Input.GetMouseButtonDown(1))
        {
            _ConfirmMovement();
        }

        if (isWatered && enableWatering)
        {
            currentWaterTimer -= Time.deltaTime;
        }

        if (currentWaterTimer <= 0)
        {
            currentWaterTimer = waterInterval;
            isWatered         = false;
        }

        if (Camera.main.orthographicSize < 3)
        {
            timerParent.GetComponent <Image>().CrossFadeAlpha(1.0f, 0.2f, true);
            moveButton.GetComponent <Image>().CrossFadeAlpha(1.0f, 0.2f, true);
            timerText.CrossFadeAlpha(1.0f, 0.2f, true);
            UpdateTime(remainTime, timerText);
        }
        else
        {
            timerParent.GetComponent <Image>().CrossFadeAlpha(0.0f, 0.2f, true);
            moveButton.GetComponent <Image>().CrossFadeAlpha(0.0f, 0.2f, true);
            timerText.CrossFadeAlpha(0.0f, 0.2f, true);
        }
    }
示例#2
0
    private IEnumerator DoTheThing()
    {
        float timeToLive = duration;

        while (timeToLive > 0)
        {
            timeToLive -= Time.deltaTime;
            yield return(null);
        }

        _text.CrossFadeAlpha(0.0f, fadeTime, false);
        Destroy(gameObject, fadeTime);
    }