Beispiel #1
0
    void Start()
    {
        Debug.Log("Game start");

        scores = ScoresContainer.Instance;

        if (sounds == null)
        {
            sounds = FindObjectOfType <Sounds>();
        }

        level = FindObjectOfType <Level>();
        if (level == null)
        {
            level = gameObject.AddComponent <Level>();
        }

        gameField = FindObjectOfType <GameField>();
        gameField.InitGameField();

        input = FindObjectOfType <GameInput>();
        if (input == null)
        {
            input = gameObject.AddComponent <GameInput>();
        }

        adShow = FindObjectOfType <AdShow>();
        adShow.Initialize();
        initNextScores();

        Load();
    }
    public static void Load()
    {
        try
        {
            if (File.Exists(Application.persistentDataPath + "/" + saveFileName))
            {
                string content = File.ReadAllText(Application.persistentDataPath + "/" + saveFileName);

                scoresContainer = JsonUtility.FromJson <ScoresContainer>(content);
            }
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
    }
Beispiel #3
0
    public void InitGameField()
    {
        Debug.Log("Init game field");

        game   = FindObjectOfType <Game>();
        scores = ScoresContainer.Instance;

        sounds          = FindObjectOfType <Sounds>();
        shapeFactory    = FindObjectOfType <Shapes>();
        level           = FindObjectOfType <Level>();
        level.gameField = this;
        parameters.Init();

        scale = parameters.Scale;

        cubeRect  = parameters.CubeRect;
        groupRect = parameters.GroupRect;

        reload = new GameOverReload(parameters.height);
    }
Beispiel #4
0
 void Awake()
 {
     game   = FindObjectOfType <Game>();
     field  = FindObjectOfType <GameField>();
     scores = ScoresContainer.Instance;
 }