Ejemplo n.º 1
0
    void LaunchNavigation(Vector3 target, int newZoneNumber, bool beginJourney)
    {
        if (lastZone)
        {
            EventManager.Instance.Raise(new GameFinishedEvent());
        }
        EventManager.Instance.Raise(new BlockInputEvent()
        {
            block = true, navigation = true
        });
        AkSoundEngine.PostEvent("Stop_SoundClue", gameObject);

        // Initialize navigation values
        navigating            = true;
        currentSpeed          = lastZone ? boatSpeedEnd : (fromTyphoon ? boatSpeedFromTyhpoon : boatSpeed);
        boatRenderer.material = boatMaterials[0];
        lightScript.rotateDegreesPerSecond.value.y = sunMove;
        target.y         = boat.transform.position.y;
        journeyLength    = (target - boat.transform.position).sqrMagnitude;
        journeyTarget    = target;
        journeyBeginTime = Time.time;

        // Update boat trail
        boatScript.AddTrailPos();

        // Update map zone
        if (newZoneNumber != map.currentZone)
        {
            map.ChangeZone(newZoneNumber);
        }

        if (beginJourney)
        {
            AkSoundEngine.PostEvent("Play_Travel", gameObject);

            // Rotate boat
            boat.transform.LookAt(target);
            Vector3 rotation = boat.transform.eulerAngles;
            rotation.z = -rotation.y;
            rotation.x = 90;
            rotation.y = 0;
            boat.transform.eulerAngles = rotation;

            // Reset field of view rotation
            boat.transform.GetChild(0).localRotation = Quaternion.Euler(0, 0, 0);

            // Dezoom
            telescope.StartNavigation();

            if (onIsland)
            {
                onIsland = false;
                screenManager.LeaveIsland();
            }
            else
            {
                screenManager.BeginNavigation();
            }
        }
    }