Example #1
0
    public void Construct(Tetrino.Type type, char[] letters, Thaum.Type[] thaums)
    {
        switch (type)
        {
        case Tetrino.Type.T1:
            _tetrino = new Tetrino1(letters, thaums, this.transform);
            break;

        case Tetrino.Type.T2:
            _tetrino = new Tetrino2(letters, thaums, this.transform);
            break;

        case Tetrino.Type.T3:
            _tetrino = new Tetrino3(letters, thaums, this.transform);
            break;

        case Tetrino.Type.T4:
            _tetrino = new Tetrino4(letters, thaums, this.transform);
            break;

        case Tetrino.Type.T5:
            _tetrino = new Tetrino5(letters, thaums, this.transform);
            break;

        default:
            Debug.LogError("Use tetrino types 1-5.");
            break;
        }
    }
Example #2
0
    public bool GiveNewTetrino()
    {
        if (!_table.CheckRTReady())
        {
            return(false);
        }

        char[]       letters;
        Thaum.Type[] thaums;
        Tetrino.Type t = (Tetrino.Type)(Random.Range((int)Tetrino.Type.T1, (int)Tetrino.Type.T5 + 1));

        if (t == Tetrino.Type.T5)
        {
            letters = _wb.GetLetters(4);
            thaums  = new Thaum.Type[4];
        }
        else
        {
            letters = _wb.GetLetters(2);
            thaums  = new Thaum.Type[2];
        }

        TetrinoDraggable tetrino = _pool.Get();

        tetrino.Construct(_table.GetCellSize(), t, letters, thaums);
        tetrino.transform.SetParent(this.transform);

        return(true);
    }
Example #3
0
    public void Construct(float size, Tetrino.Type type, char[] letters, Thaum.Type[] thaums)
    {
        bool[][] blueprint = new bool[2][];
        blueprint[0] = new bool[2];
        blueprint[1] = new bool[2];

        int nBlocks = 2;

        switch (type)
        {
        case Tetrino.Type.T5:
            blueprint[0][0] = true; blueprint[0][1] = true;
            blueprint[1][0] = true; blueprint[1][1] = true;
            nBlocks         = 4;
            break;

        case Tetrino.Type.T1:
            blueprint[0][0] = true;  blueprint[0][1] = true;
            blueprint[1][0] = false; blueprint[1][1] = false;
            break;

        case Tetrino.Type.T2:
            blueprint[0][0] = true;  blueprint[0][1] = false;
            blueprint[1][0] = true;  blueprint[1][1] = false;
            break;

        case Tetrino.Type.T3:
            blueprint[0][0] = true;  blueprint[0][1] = false;
            blueprint[1][0] = false; blueprint[1][1] = true;
            break;

        case Tetrino.Type.T4:
            blueprint[0][0] = false; blueprint[0][1] = true;
            blueprint[1][0] = true;  blueprint[1][1] = false;
            break;

        default:
            Debug.LogError("Use tetrino types 1-5.");
            break;
        }
        _tetrino.Construct(nBlocks, blueprint, size, letters, thaums);
    }
Example #4
0
    public void GiveNewTetrino()
    {
        char[]       letters;
        Thaum.Type[] thaums;
        Tetrino.Type t = (Tetrino.Type)(Random.Range((int)Tetrino.Type.T1, (int)Tetrino.Type.T5 + 1));
        if (t == Tetrino.Type.T5)
        {
            letters = _wb.GetLetters(4);
            thaums  = new Thaum.Type[4];
        }
        else
        {
            letters = _wb.GetLetters(2);
            thaums  = new Thaum.Type[2];
        }

        TetrinoDraggable tetrino = _pool.Get();

        tetrino.Construct(t, letters, thaums);

        tetrino.transform.SetParent(this.transform);
    }