Beispiel #1
0
    // Use this for initialization
    void Awake()
    {
        blocks           = new int [20, 10];
        tetromino        = tetrominoObj.GetComponent <TetrominoController> ();
        queue            = queueObj.GetComponent <NextTetrominos> ();
        hold             = holdObj.GetComponent <HoldTetromino> ();
        networkBlocks    = "";
        justSpanwed      = true;
        gameRunning      = false;
        dropDelay        = 1f;
        dropDelayCounter = dropDelay;
        ResetCurrentPos();
        x      = new int[4];
        y      = new int[4];
        startX = -1.88f;
        startY = 4.005f;
        InitializeBlocksObj();
        UpdateBlocksState();
        randomedTetrominos = new int[4];
        RandomTetrominos();
        holdUsed = false;
        pushUsed = false;
        time     = 120f;
        score    = 0;

        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tetris-a8118.firebaseio.com/");

        // Get the root reference location of the database.
        reference = FirebaseDatabase.DefaultInstance.RootReference;
        reference.ValueChanged += (object sender, ValueChangedEventArgs args) => {
            if (args.DatabaseError != null)
            {
                Debug.LogError(args.DatabaseError.Message);
                return;
            }
            if (args.Snapshot.Child(myEnemy).HasChild("score"))
            {
                escore = args.Snapshot.Child(myEnemy).Child("score").Value.ToString();
            }
        };
    }
Beispiel #2
0
 /// <summary>
 /// Invokes the HoldTetromino event
 /// </summary>
 /// <param name="holdBlocks"></param>
 protected virtual void OnHoldTetromino(Block[] holdBlocks)
 {
     HoldTetromino?.Invoke(this, new BlockEventArgs(holdBlocks));
 }