/// <summary>
    ///     Use this for initialization
    /// </summary>
    void Start()
    {
        // Check if PersistentInfo exists
        var info = GameObject.FindGameObjectsWithTag("PersistentInfo");

        switch (info.Length)
        {
        case 0:
            _persistentInfo = Instantiate(PersistentInfoPrefab).GetComponent <PersistentInfoScript>();
            break;

        case 1:
            _persistentInfo = info[0].GetComponent <PersistentInfoScript>();
            CopyPersistentInfo();
            break;

        default:
            //TODO: fix it
            throw new MissingComponentException("Multiple copies of PersistentInfo were found");
        }

        // Assign some variables
        BombNumbers[0].Parent = this;
        BombNumbers[1].Parent = this;
        BombNumbers[2].Parent = this;

        // Set camera bounds
        ScrollingCamera.GetComponent <CameraScript>().Reset();
        CreateTiles();
    }
Exemple #2
0
    /// <summary>
    ///     Use this for initialization
    /// </summary>
    void Start()
    {
        // Check if PersistentInfo exists
        var info = GameObject.FindGameObjectsWithTag("PersistentInfo");

        switch (info.Length)
        {
        case 0:
            _persistentInfo = Instantiate(PersistentInfoPrefab).GetComponent <PersistentInfoScript>();
            break;

        case 1:
            _persistentInfo = info[0].GetComponent <PersistentInfoScript>();
            CopyPersistentInfo();
            break;

        default:
            //TODO: fix it
            throw new MissingComponentException("Multiple copies of PersistentInfo were found");
        }

        // Assign some variables
        BombNumbers[0].Parent = this;
        BombNumbers[1].Parent = this;
        BombNumbers[2].Parent = this;

        // Set camera bounds
        ScrollingCamera.GetComponent <CameraScript>().Reset();
        CreateTiles();

        // Set up the Twitch chat client to execute functions based on chat messages
        TwitchChatClient.instance.Init(() =>
        {
            //TwitchChatClient.instance.onChatMessageReceived += OnChatMessageReceived;
            TwitchChatClient.instance.onChatCommandReceived += OnChatCommandReceived;
            //TwitchChatClient.instance.onChatRewardReceived += OnChatRewardReceived;

            //MatchManager.instance.onMatchEnd += OnMatchEnd;
            //MatchManager.instance.onMatchBegin += OnMatchBegin;
        },
                                       message =>
        {
            // Error when initializing.
            Debug.LogError(message);
        });
    }