Пример #1
0
    /// <summary>
    /// Transitions between areas
    /// </summary>
    /// <returns></returns>
    private IEnumerator TransitionAreas()
    {
        nextAreaLoaded    = false;
        lastAreaDestroyed = false;

        float currentTime = Time.time;

        float time = MIN_TRAVEL_TIME + (areaIndex == 0 ? 5 : 0) - Mathf.Min(Time.time - startTravelTime, 0);

        yield return(new WaitForSeconds(time));

        AreaLoaded?.Invoke();

        currentArea.LoadArea(true);

        yield return(null);


        Transform playerSpawn = currentArea.FindSafeSpawn("PlayerSpawn");

        //GameManager.Instance.Player.gameObject.SetActive(false);
        GameManager.Instance.Player.transform.position = playerSpawn.position;
        GameManager.Instance.Player.transform.rotation = playerSpawn.rotation;
        //GameManager.Instance.Player.gameObject.SetActive(true);

        SkyboxManager.Instance.SwitchToSkybox(currentArea.Skybox);
        GameManager.Instance.SwitchState(GameState.BATTLE);
    }
Пример #2
0
 internal static void InvokeOnAreaLoaded(CommunityCenter communityCentre, string areaName, int areaNumber)
 {
     AreaLoaded?.Invoke(
         sender: null,
         e: new AreaLoadedEventArgs(
             communityCentre: communityCentre,
             areaName: areaName,
             areaNumber: areaNumber));
 }