Example #1
0
    private void Awake()
    {
        instance = this;
        Init();

        // Instantiate(monster, monster.transform.position, Quaternion.identity);
    }
Example #2
0
 private void Start()
 {
     director = LevelDirector.Instance;
     director.GameOverAction     += DisplayText;
     gameOverGroup.alpha          = 0;
     gameOverGroup.interactable   = false;
     gameOverGroup.blocksRaycasts = false;
 }
Example #3
0
    void Start()
    {
        levelDirector = new LevelDirector();

        LevelBuilder simpleIceLevelBuilder   = new IceLevelBuilder();
        LevelBuilder complexFireLevelBuilder = new FireLevelBuilder();

        levelDirector.ConstructSimpleLevel(simpleIceLevelBuilder);
        levelDirector.ConstructComplexLevel(complexFireLevelBuilder);

        Level simpleIceLevel   = simpleIceLevelBuilder.GetLevel();
        Level complexFireLevel = complexFireLevelBuilder.GetLevel();

        simpleIceLevel.PrintLevel();
        complexFireLevel.PrintLevel();
    }
Example #4
0
    // Use this for initialization
    private void Start()
    {
        _this = this;

        PopulateDictionary();

        if (m_LevelOrigin == null)
        {
            Exception exception = new Exception("There is no level origin! Give LevelDirector a level origin!");
            throw exception;
        }

        if (m_HallwayStartLength > 0)
        {
            GenerateHallwayStart(m_HallwayStartLength);
        }
    }
Example #5
0
 void Start()
 {
     director = LevelDirector.Instance;
 }
Example #6
0
 private void Start()
 {
     director = LevelDirector.Instance;
     director.GameWinAction += DisplayText;
     gameOverGroup.alpha     = 0;
 }
Example #7
0
 void Start()
 {
     director = LevelDirector.Instance;
     director.VictoryAction += DisplayText;
     victoryGroup.alpha      = 0;
 }
Example #8
0
    // Get the current scene
    //    public string currentLevel;
    //    public int currentLevelNum;
    //    public float moveTimer;
    // Use this for initialization
    void Start()
    {
        cacheCurrentLevelIndex();

        if (System.IO.File.Exists ("Save/currentSave"))
            System.IO.File.Delete ("Save/currentSave");

        displayMessage = false;
        displayPauseMenu = false;
        bool mattyProfile = false;
        bool liquidProfile = false;
        bool solidProfile = false;
        bool gasProfile = false;
        bool plasmaProfile = false;
        panTriggerActive = false;
        displayTime = 0f;
        one = 1f;
        messageToBeDisplayed = "";
        if (tipDisplayTime == 0f)
            tipDisplayTime = 10f;

        originalAmbientColor = RenderSettings.ambientLight;
        darknessTriggerSpots = new float [2];
        sceneCamera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Transform>();
        camFollow = sceneCamera.gameObject.GetComponent<CameraFollow>();

        iciclesList = new System.Collections.Generic.List<IcicleBase> ();
        GameObject[] icicleBaseArray = GameObject.FindGameObjectsWithTag ("IceCeiling");
        foreach (GameObject icicle in icicleBaseArray)
            iciclesList.Add (icicle.GetComponent<IcicleBase>());

        darkCave = false;
        darkCavesList = new System.Collections.Generic.List<DarkCave>();
        icicleBaseArray = GameObject.FindGameObjectsWithTag ("DarkCave");
        foreach (GameObject darkCaveEnterX in icicleBaseArray)
        {
            DarkCave newCave;
            Transform dcTransform = darkCaveEnterX.GetComponent<Transform>();
            Vector3 dcEnter = dcTransform.Find ("DarkCaveEnter").position;
            Vector3 dcExit = dcTransform.Find ("DarkCaveExit").position;

            newCave.Door1 = new Vector2 (dcEnter.x, dcEnter.y);
            newCave.Door2 = new Vector2 (dcExit.x, dcExit.y);
            darkCavesList.Add (newCave);
        }

        LoadTriggerMessagesFromFile ();
        GUIDimensionSetup ();

        // Creates a backup of the light intensities of all the lights in the scene.
        // This is needed since we need to lerp the light intensities to zero when player
        // enters dark caves.
        lights = GameObject.FindSceneObjectsOfType (typeof(Light)) as Light[];
        origLightIntensities = new float [lights.Length];
        for (int i = 0; i < lights.Length; i ++)
            origLightIntensities [i] = lights [i].intensity;

        // Creates a backup of the skybox assigned to the scene.
        // This is needed since we set the skybox to null as the player enters dark caves.
        origSkybox = RenderSettings.skybox;

        // Needed for dark caves. If background colour is not set to black, dark caves
        // won't be "dark" anymore.
        sceneCamera.gameObject.GetComponent<Camera>().backgroundColor = Color.black;

        // Define the GUIStyle to be used in the State Info Box at the bottom of the screen.
        stateInfoBox = new GUIStyle ();
        stateInfoBox.name = "StateInfoBox";
        stateInfoBox.alignment = TextAnchor.LowerRight;
        stateInfoBox.font = menuFont;
        stateInfoBox.normal.textColor = Color.white;

        player = GameObject.FindGameObjectWithTag ("Player").GetComponent<MainPlayerScript>();

        try
        {
            ld = GameObject.FindGameObjectWithTag ("LevelDirector").GetComponent<LevelDirector>();
        }
        catch (System.Exception e)
        {
            Debug.LogWarning ("A Level Director was not found for this level!");
        }

        try
        {
            levelStopwatch = GameObject.FindGameObjectWithTag("Stopwatch");
            stopwatch = levelStopwatch.GetComponent<Stopwatch>();

            if (PlayerPrefs.GetString(Constants.GameModeKey).Equals(Constants.GameModeSpeedRun))
            {
                stopwatch.startStopwatch();
                isSpeedRun = true;
            }

            player.setIsSpeedRun(isSpeedRun);

        }
        catch (System.NullReferenceException e)
        {
            Debug.LogWarning ("Stopwatch was not found for this level!");
        }
        catch (System.Exception e)
        {
            Debug.LogError (e.Message);
        }

        mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();

        try
        {
            subcam = GameObject.FindGameObjectWithTag("SubsectionCamera");
            subsectionCam = subcam.GetComponent<Camera>();
            //subsectionCamPos = subcam.transform;

            subsectionCam.enabled = false;
            mainCam.enabled = true;
        }
        catch (System.Exception e)
        {
            Debug.LogWarning("No subsection camera was found");
        }

        startSubsectCam = false;
    }
Example #9
0
 private void Awake()
 {
     instance = this;
     Init();
 }
Example #10
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        currentLevel = 0;
        maxHealth = 0;
        currentHealth = 0;
        totalScore = 0;
        available = 0;

        betweenLevels = false;
        windows = new List<WindowBehavior> ();
        targets = GameObject.Find ("TargetLocators");
        setUpLevel ();
    }
 private void Start()
 {
     direvtor = LevelDirector.Instance;
 }