Example #1
0
 public void FinishDeparting()
 {
     if (holdingPlayer)
     {
         SubwayManager.DepartWithPlayer();
     }
 }
Example #2
0
 void Start()
 {
     if (sm == null)
     {
         sm = this;
     }
     mapUI = GlobalController.gc.GetComponentInChildren <SubwayMapUI>(true);
     CloseMapUI();
 }
 void Update() {
     if (holdingPlayer) {
         if (InputManager.ButtonDown(Buttons.SPECIAL) || Input.GetKeyDown(KeyCode.Escape)) {
             OpenDoors();
             SubwayManager.CloseMapUI();
             Invoke("ShowPlayer", 1f);
             Invoke("EnableDoorInteracts", 2f);
         }
     }
 }
 public void FinishClosingDoors() {
     if (holdingPlayer) {
         SubwayManager.SetPlayerOffset(playerFollower.transform.position - this.transform.position);
         SubwayManager.OpenMapUI(this);
     } else {
         // skip the map, this will be called when the map closes
         ShowPlayer();
         animator.SetTrigger("Depart");
     }
 }
Example #5
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(instance.gameObject);
            instance = null;
        }

        arrSubwayStopTop  = new Transform[canGenerateMaxSubwayCnt / 2];
        arrSubwayStopDown = new Transform[canGenerateMaxSubwayCnt / 2];
    }
Example #6
0
    private void LoadFromTransition()
    {
        GlobalController.UnFadeToBlack();
        FadeAudio(1);

        if (!GlobalController.GetSaveContainer().RuntimeLoadedOnce())
        {
            return;
        }

        if (transition.subway)
        {
            SubwayManager.ArriveWithPlayer();
        }
        else if (transition.beacon != null)
        {
            GlobalController.MovePlayerToBeacon(transition.beacon);
        }
        else
        {
            GlobalController.MovePlayerTo(transition.position);
        }
    }
Example #7
0
 void OnClick()
 {
     SubwayManager.ReactToStationSelect(this.stop);
 }
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        // reset everything and then re-enable according to scene data
        PlayerController pc = GlobalController.pc;

        pc.StopForcedWalking();
        pc.inCutscene = false;
        GlobalController.UnFadeToBlack();
        GlobalController.playerFollower.EnableFollowing();
        GlobalController.playerFollower.FollowPlayer();
        GlobalController.playerFollower.EnableSmoothing();
        GlobalController.pauseEnabled = true;
        pc.UnLockInSpace();
        // if the PC wasn't dashing or in supercruise
        if (!frozePlayerBeforeTransition)
        {
            pc.SetInvincible(false);
            pc.UnFreeze();
            //and reset to wait for the next transition
            frozePlayerBeforeTransition = false;
        }
        pc.Show();
        pc.EnableShooting();

        GlobalController.ShowUI();

        if (currentBeacon != Beacon.None)
        {
            GlobalController.MovePlayerToBeacon(currentBeacon);
            GlobalController.playerFollower.SnapToPlayer();
            GlobalController.playerFollower.EnableFollowing();
            GlobalController.playerFollower.FollowPlayer();
            currentBeacon = Beacon.None;
        }
        else if (SubwayManager.playerOnSubway)
        {
            SubwayManager.ArriveWithPlayer();
        }
        else if (toPosition)
        {
            GlobalController.MovePlayerTo(position);
            toPosition = false;
            GlobalController.playerFollower.SnapToPlayer();
            GlobalController.playerFollower.EnableFollowing();
            GlobalController.playerFollower.FollowPlayer();
        }

        SceneData sd;

        if (GameObject.Find("SceneData") != null)
        {
            sd = GameObject.Find("SceneData").GetComponent <SceneData>();

            if (sd.loadOtherSceneAtStart)
            {
                LoadScene(sd.otherSceneName, Beacon.None, fade: false);
                return;
            }

            GlobalController.ShowTitleText(sd.title, sd.subTitle);

            if (sd.hideUI)
            {
                GlobalController.HideUI();
            }
            else
            {
                GlobalController.ShowUI();
            }

            if (sd.lockPlayer)
            {
                pc.LockInSpace();
                pc.SetInvincible(true);
                pc.Freeze();
                pc.DisableShooting();
            }
            else if (sd.unlockPlayer)
            {
                pc.UnLockInSpace();
                pc.SetInvincible(false);
                pc.UnFreeze();
                pc.EnableShooting();
            }

            if (sd.hidePlayer)
            {
                pc.Hide();
            }

            if (sd.forceFaceRight && !pc.facingRight)
            {
                pc.Flip();
            }

            GlobalController.pauseEnabled = sd.enablePausing;
        }

        PlayerTriggeredObject triggered = GlobalController.pc.CheckInsideTrigger();

        if (triggered != null)
        {
            triggered.OnPlayerEnter();
        }
    }
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        // reset everything and then re-enable according to scene data
        sceneData = null;
        loadTextUI.SetActive(false);
        FadeAudio(1);
        PlayerController pc = GlobalController.pc;

        pc.StopForcedWalking();
        pc.inCutscene = false;
        GlobalController.UnFadeToBlack();
        GlobalController.pauseEnabled = true;
        pc.UnLockInSpace();
        pc.Show();
        pc.ExitCutscene();
        pc.EnableShooting();

        GlobalController.ShowUI();

        if (currentBeacon != null)
        {
            GlobalController.MovePlayerToBeacon(currentBeacon);
            currentBeacon = null;
        }
        else if (SubwayManager.playerOnSubway)
        {
            SubwayManager.ArriveWithPlayer();
        }
        else if (toPosition)
        {
            GlobalController.MovePlayerTo(position, fade: true);
            toPosition = false;
        }

        SceneData sd;

        if (GameObject.Find("SceneData") != null)
        {
            sd        = GameObject.Find("SceneData").GetComponent <SceneData>();
            sceneData = sd;

            if (sd.loadOtherSceneAtStart)
            {
                LoadScene(sd.otherSceneName, null, fade: false);
                return;
            }

            GlobalController.ShowTitleText(sd.title, sd.subTitle);

            if (sd.hideUI)
            {
                GlobalController.HideUI();
            }
            else
            {
                GlobalController.ShowUI();
            }

            if (sd.lockPlayer)
            {
                pc.EnterCutscene();
            }
            else if (sd.unlockPlayer)
            {
                pc.ExitCutscene();
            }

            if (sd.hidePlayer)
            {
                pc.Hide();
                pc.EnterCutscene();
            }

            if (sd.forceFaceRight && !pc.facingRight)
            {
                pc.Flip();
            }

            GlobalController.pauseEnabled = sd.enablePausing;
        }

        PlayerTriggeredObject triggered = GlobalController.pc.CheckInsideTrigger();

        if (triggered != null)
        {
            triggered.OnPlayerEnter();
        }
    }
Example #10
0
 void OnRestart()
 {
     instance = null;
 }