Exemple #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();
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        gameMgr = GameObject.FindGameObjectWithTag("GameController");
        npcMgr  = (NPCManager)gameMgr.GetComponent(typeof(NPCManager));
        if (npcMgr.freeze)
        {
            freeze = true;
        }
        else
        {
            freeze = false;
        }

        target    = GameObject.Find("Player");
        rb        = GetComponent <Rigidbody2D> ();
        moveSpeed = Random.Range(0.1f, 0.3f);
        ad        = target.GetComponent <AdShow>();
    }