Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (useUI)
        {
            setGameState(GameState.GUI);
            missionManager.playUI(uiList[lastUIPlayed].name);
            lastUIPlayed++;
        }
        controller     = player.GetComponent <PerfectController> ();
        controller.yaw = yawOnStart;
        currLevel      = player.GetComponent <CurrentLevel>();
        lastLocation   = currLevel.getCurrLocation();
        locationSet    = new Dictionary <GameLocation, Transform>();

        //Map all locations to their enum in locations map.
        foreach (Transform location in locations.transform)
        {
            if (location.gameObject.name.Equals("TopDownInteriors"))
            {
                //Debug.Log("In TDI");
                foreach (Transform room in location)
                {
                    if (!room.gameObject.name.Equals("Transports_TDI"))
                    {
                        GameLocation enumLoc = switchLocation(room.gameObject.name);
                        locationSet.Add(enumLoc, room);
                        //Debug.Log(room.gameObject.name);
                        if (room.gameObject.activeSelf && firstLoad)
                        {
                            currLevel.setCurrLocation(enumLoc);
                        }
                    }
                }
            }
            else
            {
                GameLocation enumLoc = switchLocation(location.gameObject.name);
                locationSet.Add(enumLoc, location);
                //Debug.Log(location.gameObject.name);
                if (location.gameObject.activeSelf && firstLoad)
                {
                    currLevel.setCurrLocation(enumLoc);
                }
            }
        }

//		Screen.showCursor = true;
//		Screen.lockCursor = true;
        pauseMenu        = saveManagerObject.GetComponent <PauseMenu>();
        playerScreenFade = playerCamera.GetComponent <PlayerScreenFade>();
        controller       = player.GetComponent <PerfectController>();
        playerChar       = player.GetComponent <CharacterOurs>();
        currState        = GameState.START;
        lastState        = GameState.START;
        firstLoad        = false;
        if (!useUI)
        {
            StartGame();
        }
    }
Ejemplo n.º 2
0
    public void UpdatePlayer(Transform player)
    {
        UpdateTransform(this.player, player);
        PerfectController controller = player.GetComponent <PerfectController> ();

        controller.UpdatePlayer(EventHandler.GameState.PAUSE);
        player.GetComponent <Rigidbody> ().useGravity = true;
    }