Exemplo n.º 1
0
    public void OnPlayerEnteredPortal(SubDungeonPortal portal)
    {
        Player player            = CommonObjects.Player_C;
        ZeldaPlayerController pc = player.PlayerController;
        Transform             t  = pc.transform;

        SubDungeon destinationSubDungeon = SpawnPoint.warpTo.SpawnSubDungeon();
        Transform  warpToLocation        = destinationSubDungeon.warpInLocation;

        Vector3 eulerDiff = warpToLocation.eulerAngles - portal.transform.eulerAngles;

        Vector3 offset = t.position - portal.transform.position;

        offset     = Quaternion.Euler(eulerDiff) * offset;
        t.position = warpToLocation.position + offset;

        //OVRCameraRig camRig = pc.GetComponentInChildren<OVRCameraRig>();
        //Transform camera = camRig.transform;
        //camera.eulerAngles += eulerDiff;
        Vector3 newEuler = pc.transform.eulerAngles + eulerDiff;

        player.ForceNewRotation(newEuler);

        pc.Stop();


        ParentDungeonRoom.onPlayerExitedRoom();
        destinationSubDungeon.ParentDungeonRoom.OnPlayerEnteredRoom();

        /*print("warpToLocation.eulerAngles: " + warpToLocation.eulerAngles);
         * print("portal.transform.eulerAngles: " + portal.transform.eulerAngles);
         * print("eulerDiff: " + eulerDiff);
         * print("t.forward: " + t.forward);*/
    }
Exemplo n.º 2
0
    void WarpToPortalInsideGrotto(GrottoPortal fromPortal)
    {
        Player player            = CommonObjects.Player_C;
        ZeldaPlayerController pc = player.PlayerController;

        GrottoSpawnPoint warpToGrottoSP    = null;
        Transform        warpToLocation    = null;
        Grotto           destinationGrotto = null;

        if (fromPortal == Grotto.warpA)
        {
            warpToGrottoSP    = GrottoSpawnPoint.warpToA;
            destinationGrotto = warpToGrottoSP.SpawnGrotto();
            warpToLocation    = destinationGrotto.warpA.transform;
        }
        else if (fromPortal == Grotto.warpB)
        {
            warpToGrottoSP    = GrottoSpawnPoint.warpToB;
            destinationGrotto = warpToGrottoSP.SpawnGrotto();
            warpToLocation    = destinationGrotto.warpB.transform;
        }
        else if (fromPortal == Grotto.warpC)
        {
            warpToGrottoSP    = GrottoSpawnPoint.warpToC;
            destinationGrotto = warpToGrottoSP.SpawnGrotto();
            warpToLocation    = destinationGrotto.warpC.transform;
        }


        Vector3 eulerDiff = warpToLocation.eulerAngles - fromPortal.transform.eulerAngles;

        Transform t      = pc.transform;
        Vector3   offset = t.position - fromPortal.transform.position;

        offset     = Quaternion.Euler(eulerDiff) * offset;
        t.position = warpToLocation.position + offset;

        Vector3 newEuler = pc.transform.eulerAngles + eulerDiff;

        player.ForceNewRotation(newEuler);

        pc.Stop();

        OnPlayerExit();
        destinationGrotto.OnPlayerEnter();
    }
Exemplo n.º 3
0
    // TODO: shouldn't be public
    public void LimitControls()
    {
        if (_controlsHaveBeenLimited)
        {
            return;
        }
        _controlsHaveBeenLimited = true;

        PauseManager pm = PauseManager.Instance;

        pm.IsPauseAllowed_Inventory = false;
        pm.IsPauseAllowed_Options   = false;

        CommonObjects.Player_C.IsParalyzed = true;

        ZeldaPlayerController pc = CommonObjects.PlayerController_C;

        _storedGravityEnabledState = pc.gravityEnabled;
        pc.gravityEnabled          = false;
    }