Example #1
0
 private void Respawn()
 {
     GAMESTATE = GameEventManager.GameState.Live;
     InvokeRepeating("updateMinute", 0f, 0.10f);
     GameUI.dialogPop.giveInfos("This place doesn't look really comfy. \n I should find a paper and send a letter\n to Mina for some help.");
     currD = 1;
     currH = 13;
     currM = 1;
     writtenPaper = 0;
     realWrittenPaper = 0;
     saveDay = 1000;
     respawnPaper(PaperSpots);
 }
Example #2
0
 private void GameStart()
 {
     GAMESTATE = GameEventManager.GameState.MainMenu;
 }
Example #3
0
 private void GameOver()
 {
     GAMESTATE = GameEventManager.GameState.GameOver;
     CancelInvoke("updateMinute");
 }
Example #4
0
 private void EndGame()
 {
     GAMESTATE = GameEventManager.GameState.EndGame;
     CancelInvoke("updateMinute");
 }
Example #5
0
    // Use this for initialization
    void Awake()
    {
        plr = GetComponentInChildren<Player>();
        plr.Setup(this);

        TUNING = Resources.Load("Scripts/Tuning") as DTTuning;

        Hours = gameObject.AddComponent<HoursManager>();
        Hours.Setup(this);

        remainingDay = TUNING.DaysComingBeforeSaveDay;

        pathDirector = GetComponentInChildren<WaypointDirector>();
        pathDirector.Setup(this);

        Dracu = GetComponentInChildren<Dracula>();
        Dracu.Setup(this);

        Diff = DifficultyState.BeforeLetter;

        PaperSpots = new List<GameObject>();
        GameObject pSpot = FETool.findWithinChildren(gameObject, "Spots/PaperSpot");
        Spot[] papSpot = pSpot.GetComponentsInChildren<Spot>();
        foreach (Spot obj in papSpot)
        {
            obj.spotType = Spot.spotList.Paper;
            PaperSpots.Add(obj.gameObject);
        }

        FoodSpots = new List<GameObject>();
        GameObject fSpot = FETool.findWithinChildren(gameObject, "Spots/FoodSpot");
        Spot[] fooSpot = fSpot.GetComponentsInChildren<Spot>();
        foreach (Spot obj in fooSpot)
        {
            obj.spotType = Spot.spotList.Food;
            FoodSpots.Add(obj.gameObject);
        }

        //		respawnPaper(PaperSpots);
        spawnFood(FoodSpots);
        saveDay = 1000;

        MailmanState = MailManStateList.Away;
        currCam = FETool.findWithinChildren(gameObject, "Camera").GetComponent<Camera>();
        GameUI = currCam.GetComponentInChildren<UI>();
        GameUI.Setup(this);

        GetComponentInChildren<MailManPlace>().Setup(this);
        bedList = GetComponentsInChildren<Bed>();

        Door[] Doors = GetComponentsInChildren<Door>();
        foreach (Door _dr in Doors)
        {
            _dr.Setup(this);
        }

        Waypoint[] Waypo = GetComponentsInChildren<Waypoint>();
        foreach (Waypoint _wp in Waypo)
        {
            wpList.Add(_wp);
        }

        GameEventManager.GameOver += GameOver;
        GameEventManager.Respawn += Respawn;
        GameEventManager.GameStart += GameStart;
        GameEventManager.EndGame += EndGame;

        MasterAudio.PlaySound("ambiance");

        //				GAMESTATE = GameEventManager.GameState.MainMenu;
        //				GameEventManager.TriggerRespawn("Rsp");
        GAMESTATE = GameEventManager.GameState.Live;
        GameEventManager.TriggerGameStart("First Init");
    }
Example #6
0
    // Use this for initialization
    public void Awake()
    {
        if (GameObject.Find("Frameworks") == null)
        {
            GameObject fmObj = Instantiate(Resources.Load("Presets/Frameworks")) as GameObject;
            fmObj.name = "Frameworks";
        }

        if (GameObject.FindGameObjectWithTag("PlayerData") == null)
        {
            GameObject _dataplayer = Instantiate(Resources.Load("Presets/PlayerData")) as GameObject;
            _profile = _dataplayer.GetComponent<PlayerData>();
            _profile.Launch();
        }
        else
        {
            _profile = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>();
            _profile.Launch();
        }

        if (_profile.SETUP.GameType == GameSetup.versionType.Demo)
        {
        //			Screen.SetResolution(800,600, false);
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().pixelPerfectResolution = new Vector2(800f,600f);
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().alwaysPixelPerfect = true;
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().customSize = 4;
        }

        GAMESTATE = _EditorState;
        _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        GlobTuning = Instantiate(Resources.Load("Tuning/Global")) as LPTuning;
        InputMan = Instantiate(Resources.Load("Tuning/InputManager")) as InputManager;
        CurrentLevelInfo = Instantiate(Resources.Load("Tuning/Levels/" + NAME)) as LevelInfo;

        LocalTuning = Instantiate(Resources.Load("Maps/" + NAME + "/Setup")) as LevelParameters;
        LocalTuning.initScript();

        GameObject OutSpw = new GameObject("OuterSpawn");
        OuterSpawn = OutSpw;
        OuterSpawn.transform.parent = FETool.findWithinChildren(this.gameObject, "Enviro").transform;
        OuterSpawn.transform.position = new Vector3(0f, -7.5f, 0f);

        tools = gameObject.AddComponent<LevelTools>();
        tools._levMan = this;
        TranslateAllInScene();

        CollectiblePlaces[] collecPla = FETool.findWithinChildren(this.gameObject, "Enviro/CollectiblePlaces").GetComponentsInChildren<CollectiblePlaces>();
        foreach (CollectiblePlaces cpl in collecPla)
        {
            collecPlaces.Add(cpl);
        }
        Gate = GameObject.FindGameObjectWithTag("SpaceGate").GetComponent<SpaceGate>();
        Gate.Setup(this);

        wpDirector = GetComponentInChildren<WaypointDirector>();
        wpDirector.Setup(this);

        bricksMan = FETool.findWithinChildren(this.gameObject, "LevelBricks/Bricks").GetComponent<BricksManager>();
        bricksMan.Setup();

        if (GAMETYPE != LocalTuning.levelType)
        {
            Debug.Log("Type of LevelMana & Setup scrip arent't the same");
        }
        GAMETYPE = LocalTuning.levelType;
        switch (GAMETYPE)
        {
        case LevelParameters.levelTypeList.Debuggin :
        {
            linearTrigger = gameObject.AddComponent<LinearStepTrigger>();
            linearTrigger.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Linear :
        {
            linearTrigger = gameObject.AddComponent<LinearStepTrigger>();
            linearTrigger.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Maze :
        {
            break;
        }
        case LevelParameters.levelTypeList.Procedural :
        {
            GameObject gameo = FETool.createGameObject("ProceduralManager", gameObject);
            ProcMana = gameo.AddComponent<Procedural>();
            ProcMana.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Vertical :
        {
            GameObject vm = new GameObject("VerticalManager");
            VerticalManager = vm.AddComponent<VerticalScroller>();
            vm.transform.parent = this.transform;
            VerticalManager.Setup(this);
            break;
        }
        }

        wpDirector.affectRelatedBricks(bricksMan.BricksList);

        if (LocalTuning.levelType != LevelParameters.levelTypeList.Debuggin)
        {
            if (GameObject.Find("UI") == null)
            {
                GameObject uiman = Instantiate(Resources.Load("Presets/UI")) as GameObject;
                uiman.name = "UI";
                menuManager = uiman.GetComponent<MainMenu>();
            }
            else
            {
                menuManager = GameObject.Find("UI").GetComponent<MainMenu>();
            }
        }
        if (menuManager != null)
        {
            menuManager.Setup(this);
        }
        managerChecker();
        //		proc.triggerStep(proc._listSteps[0]);
        _player.Setup();
        Setup();
    }