Пример #1
0
    public GameField(string track)
    {
        currentRule = new DefaultRule();
        width       = Config.Logic.GridLength();
        height      = Config.Logic.GridDepth();
        field       = new List <Cube>();

        Score score = (Score)GameObject.FindGameObjectWithTag("Score").GetComponent("Score");
        //Message message = (Message)GameObject.FindGameObjectWithTag("Message").GetComponent("Message");
        Multiplier multiplier = (Multiplier)GameObject.FindGameObjectWithTag("Multiplier").GetComponent("Multiplier");

        Config     config     = (Config)GameObject.Find("Config").GetComponent("Config");
        GameObject beatPrefab = config.beatPrefab;

        beat = (Beat)((GameObject)GameObject.Instantiate(beatPrefab)).GetComponent("Beat");
        beat.gameObject.name = "Beat";
        beat.SetPosition(width / 2, height / 2);

        powerUp      = GameObject.Find("PowerUp").GetComponent("Item") as Item;
        powerUp.rule = new DefaultRule();

        //message.setBeatReference(beat);
        score.setBeatReference(beat);
        multiplier.setBeatReference(beat);

        try {
            // Right to Left map
            RtoLmap = new LevelMap(track);
            CheckCompliance();
        } catch (Exception) {
            throw;
        }
        InitBoard();

        Item.config = config;
    }