Exemplo n.º 1
0
    public TileManager(Controller c, int s, int fw, int fh)
    {
        tiles       = new List <Tile> ();
        FieldWidth  = fw;
        FieldHeight = fh;
        blocks      = new Block [fieldWidth * fieldHeight];
        timePassed  = 0f;
        timePerMove = 0.25f;
        player      = c;

        currentSpecialEffect = SpecialEffect.NONE;
        specialEffectTimer   = 0;

        id = currentid;
        currentid++;
        PrefabManager pm = GameObject.Find("PrefabManager").GetComponent <PrefabManager> ();

        prefabBlock       = pm.prefabBlock;
        prefabBlockBorder = pm.prefabBorderBlock;

        startingPoint      = fieldWidth / 2;
        startingPointField = s;

        tilesToAdd = new Queue <Tile> ();

        tg = TileGenerator.GetTileGenerator;

        tg.CreateTile();

        AddBorder();
        AddTile(tg.GetTile(id));

        blockRotation = false;

        if (OnSpecialEffect == null)
        {
            OnSpecialEffect = new SpecialEffectEvent();
        }

        OnSpecialEffect.AddListener(ApplyEffect);
    }