示例#1
0
    // plane was clicked for rotation
    private void OnMouseDown()
    {
        if (notInteractable)
        {
            if (flying)
            {
                return;
            }
            if (planeMan.TryToPlacePlane())
            {
                foreach (BoxCollider collider in planeColliders)
                {
                    collider.enabled = false;
                }
                StartCoroutine(FollowFinger());
            }
        }
        else
        {
            switch (planeRotation)
            {
            case PlaneRotation.NONE:
                if (planeMan.TryToRotatePlane())
                {
                    planeRotation               = PlaneRotation.RIGHT;
                    arrowsMesh.material         = arrowMats[1];
                    markerRotator.RotationSpeed = defaultRotFBSpeed;
                    planeTransform.Rotate(planeTransform.up, 90);
                    movementFeedback.transform.Rotate(planeTransform.up, 90);
                    if (AllowSound)
                    {
                        audioSource.Play();
                    }
                }
                break;

            case PlaneRotation.RIGHT:
                planeRotation = PlaneRotation.LEFT;
                planeTransform.Rotate(planeTransform.up, -180);
                movementFeedback.transform.Rotate(planeTransform.up, -180);
                if (AllowSound)
                {
                    audioSource.Play();
                }
                break;

            case PlaneRotation.LEFT:
                arrowsMesh.material = arrowMats[0];
                planeRotation       = PlaneRotation.NONE;
                planeMan.PlaneIsRotatedToDefault();
                planeTransform.Rotate(planeTransform.up, 90);
                movementFeedback.transform.Rotate(planeTransform.up, 90);
                if (AllowSound)
                {
                    audioSource.Play();
                }
                break;
            }
        }
    }
示例#2
0
 // preparing to move to the next field
 public void Move()
 {
     notInteractable = true;
     planeRotation   = PlaneRotation.NONE;
     if (moveFBAnim != null)
     {
         moveFBAnim.SetTrigger("Move");
     }
     if (flying)
     {
         movementCoroutine = StartCoroutine(MoveToNextField());
     }
 }