Пример #1
0
 private void Setup()
 {
     //SaveManager.LoadFromTemplate(defaultInv);
     goldAmount.enabled = false;
     ShopButton.SetActive(false);
     MoveCameraBackButton.SetActive(false);
 }
Пример #2
0
    //When the player clicks on a town bubble, this handles the related actions such as moving the camera, scaling and
    //sprite ordering
    private void ChooseTown(RaycastHit hit)
    {
        mapInteraction = true;
        canMoveAround  = false;
        townHit        = hit;

        //Get rid of back button (which moves camera to starting position)
        MoveCameraBackButton.SetActive(false);

        //Sound effect
        SFX.Play("Map_location_select", 1f, 1f, 0f, false, 0f);

        //Move all townObjs to globe by first killing current tweens and then sending them back to the initial pos
        ReturnToGlobe();

        //Change layer of chosen town to be above others
        hit.transform.gameObject.GetComponent <SpriteRenderer>().sortingLayerName = "Default";

        //Finish all previous tweens
        foreach (GameObject town in townObjects)
        {
            town.transform.DOComplete();
        }

        //Move camera to inspect pos and make chosen town larger
        Camera.main.transform.DOMove(inspectPos, 1f, false).OnComplete(() =>
                                                                       hit.transform.DOMove(townInspectPosition.transform.position, 0.1f, false).OnComplete(() =>
                                                                                                                                                            hit.transform.DOScale(new Vector3(0.0014f, 0.0014f, 0.0014f), 1f)));

        //Load Relevant canvas elements
        Travel.Towns currentTown = CurrentTownObject(hit.transform.gameObject);
        ShowRelevantTownUI(currentTown, true);
    }
Пример #3
0
    //Rescales the selected town, moves the camera back and then starts them circling the sphere again
    public void ExitMapInteraction()
    {
        //Show back button (which moves camera to starting position)
        if (!GameManager.Instance.InMap)
        {
            MoveCameraBackButton.SetActive(true);
        }

        //Finish all existing Tweens
        foreach (GameObject town in townObjects)
        {
            town.transform.DOComplete();
        }

        townHit.transform.DOScale(new Vector3(0.0007f, 0.0007f, 0.0007f), 0.1f).OnComplete(() => MoveAroundGlobe());
        Camera.main.transform.DOMove(frontPos, 1f).SetEase(Ease.InOutSine);
        HideTownUIAndButtons();
    }
Пример #4
0
 private void MoveCamera()
 {
     Debug.Log("Map Interaction is " + mapInteraction);
     if (!mapInteraction && MapTutorial.Instance.CanMoveCamera)
     {
         //Debug.Log("Not interacting with map");
         if (!forward)
         {
             Debug.Log("Moving Forward");
             Camera.main.transform.DOMove(frontPos, 1f).SetEase(Ease.InOutSine).OnComplete(() => forward = true);
             goldAmount.enabled = true;
             MoveAroundGlobe();
             MoveCameraBackButton.SetActive(true);
             ShopButton.gameObject.SetActive(false);
             if (GameManager.Instance.InMap)
             {
                 MoveCameraBackButton.SetActive(false);
                 if (!mapTutorialManager.clickedOrb)
                 {
                     mapTutorialManager.ClickedSphere();
                     canMoveAround = false;
                 }
             }
             mapInteraction = false;
         }
         else
         {
             Debug.Log("Moving Back");
             Camera.main.transform.DOMove(backPos, 1f).SetEase(Ease.InOutSine).OnComplete(() => forward = false);
             Camera.main.transform.DORotate(defaultRotation, 1f, RotateMode.Fast);
             goldAmount.enabled = false;
             canMoveAround      = false;
             MoveCameraBackButton.SetActive(false);
             ReturnToGlobe();
         }
     }
 }
Пример #5
0
    private void RayCastSphere()
    {
        if (forward)
        {
            //Just need to handle the tutorial now that the system has changed.
            if (GameManager.Instance.InMap)
            {
                MoveCameraBackButton.SetActive(false);
            }

            //Raycast for the town  objects.
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            Debug.DrawLine(ray.origin, ray.direction, Color.red, 4f);
            if (Physics.Raycast(ray, out hit, 1))
            {
                Debug.Log(hit.transform.gameObject.name + " hit" + " can select towns " + canMoveAround);
                if (!GameManager.Instance.InMap)
                {
                    if (hit.transform.gameObject.CompareTag("Town") && canMoveAround)
                    {
                        Debug.Log("Choosing town");
                        ChooseTown(hit);
                    }
                    else if (trueGolemHandler.inspectingGolem &&
                             hit.transform.gameObject == trueGolemHandler.golemSelected &&
                             !trueGolemHandler.readingDialogue)
                    {
                        trueGolemHandler.ReshowDialogue();
                    }
                }
                else
                {
                    if (hit.transform.gameObject.CompareTag("Town") && canMoveAround && mapTutorialManager.canSelectTowns)
                    {
                        Debug.Log("Choosing town");
                        ChooseTown(hit);
                    }
                }
            }
        }
        else
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            Debug.DrawLine(ray.origin, ray.direction, Color.red, 4f);
            Debug.Log("Drawing ray");
            if (Physics.Raycast(ray, out hit, 5))
            {
                Debug.Log("Hit " + hit.transform.gameObject.tag);
                if (hit.transform.gameObject.CompareTag("Globe"))
                {
                    MoveCamera();
                }
                else if (hit.transform.gameObject.CompareTag("TrueGolem"))
                {
                    trueGolemHandler.HighlightTrueGolem(hit.transform.gameObject);
                    forward = true;
                    MoveCameraBackButton.SetActive(true);
                }
            }
            //mapInteraction = false;
        }
    }