示例#1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (currentArrow == null)
        {
            return;
        }
        //Debug.Log("OnEndDrag()");
        Vector2 force = GetForceFromTwoPoint(transform.position, centerPosition);

        currentArrow.RemoveProjectileArc();
        currentArrow.Launch(force);
        transform.position = centerPosition;
        if (moveCameraAfterLaunch)
        {
            moveableCameraController.SetFollowTarget(currentArrow.mGameObject.transform);
            moveableCameraController.SwitchToFollow();
        }
        arrowNums[currentArrowType] = arrowNums[currentArrowType] - 1;

        // Rotate cupid back to default position after arrow is shot
        cupidAnchor.rotation = Quaternion.Euler(0, 0, 0);
        currentArrow.mGameObject.transform.rotation = Quaternion.Euler(0, 0, 0);
        arrowButtonPointer.transform.rotation       = Quaternion.Euler(0, 0, -90.0f);

        audio.PlayMusic();
    }
    public void SetInLove()
    {
        if (!inLove)
        {
            inLove = true;
            stageController.UpdateScore(1000);
            GetComponent <BoxCollider2D>().enabled = false;

            animator.SetBool("inLove", true);
            arrowHitCoupleAudio.PlayMusic();
            hitEffect.Play();
            heartEffect.Play();

            if (moveCupidAfterHit)
            {
                uIForceArrowButtonController.MoveCupidTo(cupidPosAfterHit);
            }
            if (moveCameraAfterHit)
            {
                moveableCameraController.SetFollowTarget(transform);
                moveableCameraController.SwitchToFollow();
            }
        }
    }