// 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();
        }
    }
Beispiel #2
0
 public DropAction(GameObject who, GrabMe.kind what)
 {
     this.who = who;
     if (who.GetComponent <CharacterOurs> () != null)
     {
         whoIs = who.GetComponent <CharacterOurs> ();
     }
     this.what          = what;
     interactionManager = GameObject.Find("InteractionManager");
     guiHandler         = interactionManager.GetComponent <GUIHandler> ();
 }
    //toEnter must have an EnterScript on it!
    public EnterAction(GameObject willEnter, GameObject toEnter, string text)
    {
        this.willEnter       = willEnter;
        this.toEnter         = toEnter;
        this.collisionScript = toEnter.GetComponent <EnterScript> ();
        //this.collisionScript.setWillEnter(willEnter);
        this.character = willEnter.GetComponent <CharacterOurs> ();

        interactionManager = GameObject.Find("InteractionManager");
        guiHandler         = interactionManager.GetComponent <GUIHandler> ();
        this.text          = text;
    }