Beispiel #1
0
    void UpdateLockLine()
    {
        if (!BelongRole.IsLockFish() || BelongRole.LockFish == null || BelongRole.LockFish.Caught())
        {
            m_LineImg.fillAmount = 0f;
            return;
        }

        Canvas  cv      = BelongRole.GameBase.GameCanvas;
        Vector3 ms      = RectTransformUtility.WorldToScreenPoint(cv.worldCamera, BelongRole.LockUI.transform.position);
        Vector3 linePos = RectTransformUtility.WorldToScreenPoint(cv.worldCamera, m_LineImg.transform.position);

        Vector2 targetDir = ms - linePos;
        float   len       = targetDir.magnitude;
        float   uiLen     = m_LineImg.rectTransform.rect.width;

        m_LineImg.fillAmount = len / uiLen;
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (BelongRole.IsLocal())
        {
            m_shootTimer -= Time.deltaTime;

            if (!BelongRole.IsLockFish())
            {
                UpdateInput();
            }
            else
            {
                UpdateLocked();
            }
        }
        else
        {
            UpdateLockLine();
        }
    }