Пример #1
0
    /// <summary>
    /// Get the data and initialize it
    /// </summary>
    public void Awake()
    {
        if (control == null) {
            DontDestroyOnLoad(gameObject);
            control = this;
        }else if (control != this) {
            Destroy(gameObject);
        }

        //initialize stored scores
        scoreLevels.SetScoreLevels();
        //initialize stored unlocked levels
        string unlocked = PlayerPrefs.GetString(PlayerDataStoreKeys.PlayerUnlockedLevels);
        //if have some data, use it over the inspector data
        if (unlocked.Trim().Length != 0) {
            informationLevels.SetUnlockedLevels(unlocked.Trim());
        } else {
            //store it
            string data = informationLevels.ResumeStringUnlockedLevel();
            PlayerPrefs.SetString(PlayerDataStoreKeys.PlayerUnlockedLevels, data);
            PlayerPrefs.Save();
        }

        if (defaultScene.name == "Not" || defaultScene.name == "") {
            Debug.LogWarning("Next Scene not setted, using Menu by default, please, assign an scene");
            defaultScene.name = "Menu";
        }
    }
Пример #2
0
        static void Main(string[] args)
        {
            GameController     manager  = new GameController();
            GameControllerData gameData = new GameControllerData("Home", "Guest");

            manager.Create(gameData);

            Console.WriteLine(manager.Game);

            manager.Start();
            Console.ReadLine();
        }
Пример #3
0
    /// <summary>
    /// Get all levels and prepare the map
    /// </summary>
    public void Awake()
    {
        _menuNavigator = GameObject.FindGameObjectWithTag(Tags.Menus).GetComponent<MenuNavigator>();
        _data = GameObject.FindGameObjectWithTag(Tags.GameData).GetComponent<GameControllerData>();

        _levels = new List<GameObject[]>();
        _levelsindicator = new List<Indicator[]>();

        _titleWorld = cameraCanvas.GetComponentInChildren<TextInternationalizationMesh>();
        MeshRenderer titleRender = cameraCanvas.GetComponentInChildren<MeshRenderer>();
        titleRender.sortingOrder = 100;

        _transformCamera = cameraCanvas.GetComponent<Transform>();

        //show the world but not focus
        _actualLevelInfo.world = -1;
        _actualLevelInfo.level = -1;
    }
    void Start()
    {
        // Get reference to audio sources
        _audioSources = GetComponents<AudioSource>();

        //Get data game and store the next level
        if (Application.isPlaying)
            _data = GameObject.FindGameObjectWithTag(Tags.GameData).GetComponent<GameControllerData>();
    }
Пример #5
0
    /// <summary>
    /// Unity's method called when the entity is created.
    /// Recovers the desired componentes of the entity.
    /// </summary>
    public void Awake()
    {
        // Retrieves the components of the entity.
        _collider = gameObject.GetComponent<BoxCollider>();

        // Retrieves the UI Reference
        _menuNavigator = GameObject.FindGameObjectWithTag(Tags.Menus).GetComponent<MenuNavigator>();

        //Get data game and store the next level
        if(Application.isPlaying)
            _data = GameObject.FindGameObjectWithTag(Tags.GameData).GetComponent<GameControllerData>();
    }