// Start is called before the first frame update

    public void NavigateToPlayScene()
    {
        FirebaseScript2 addPlayerToGame = new FirebaseScript2();

        addPlayerToGame.AddToGame();
        SceneManager.LoadScene("PlayScene");
    }
    void Start()
    {
        place1a.position   = pos1a;
        place1a.isAvalible = true;
        place2a.position   = pos2a;
        place2a.isAvalible = true;
        place3a.position   = pos3a;
        place3a.isAvalible = true;
        place4a.position   = pos4a;
        place4a.isAvalible = true;
        place5a.position   = pos5a;
        place5a.isAvalible = true;
        place6a.position   = pos6a;
        place6a.isAvalible = true;

        place1b.position         = pos1b;
        place1b.isAvalible       = true;
        place2b.position         = pos2b;
        place2b.isAvalible       = true;
        place3b.position         = pos3b;
        place3b.isAvalible       = true;
        place4b.position         = pos4b;
        place4b.isAvalible       = true;
        place5b.position         = pos5b;
        place5b.isAvalible       = true;
        place6b.position         = pos6b;
        place6b.isAvalible       = true;
        playBoard.playboardItems = new List <Place>();
        playBoard.addPlayboardItem(place1a);
        playBoard.addPlayboardItem(place1b);
        playBoard.addPlayboardItem(place2a);
        playBoard.addPlayboardItem(place2b);
        playBoard.addPlayboardItem(place3a);
        playBoard.addPlayboardItem(place3b);
        playBoard.addPlayboardItem(place4a);
        playBoard.addPlayboardItem(place4b);
        playBoard.addPlayboardItem(place5a);
        playBoard.addPlayboardItem(place5b);
        playBoard.addPlayboardItem(place6a);
        playBoard.addPlayboardItem(place6b);
        // if no target specified, assume the player
        if (target == null)
        {
            if (GameObject.FindWithTag("Player") != null)
            {
                target = GameObject.FindWithTag("Player").GetComponent <Transform>();
            }
        }
        playerCardInfo = new FirebaseScript2();
    }
    void Start()
    {
        playerCardInfo = new FirebaseScript2();
        times++;
        //FirebaseScript playerCardInfo = new FirebaseScript();
        p1              = gameManager.player1Reciever.gameObject;
        p2              = gameManager.player2Reciever.gameObject;
        Player1Cards    = p1.GetComponent <addCards>().pl1;
        Player2Cards    = p2.GetComponent <addCardsPlayer2>().pl2;
        player1CardSize = p1.GetComponent <addCards>().pl1Size;
        player2CardSize = p2.GetComponent <addCardsPlayer2>().pl2Size;


        time1 += Time.deltaTime;
        time2 += Time.deltaTime + 0.1f;
        //if (time1 > 3)
        //{
        playerCardInfo.RetreiveCoordinateFromDatabse();
        //    time1 = 0;
        //}

        //if (time1 > 3) {

        /*
         * for (int i = 0; i < player1CardSize; i++)
         * {
         *  string posx = Player1Cards[i].gameObject.transform.position.x.ToString();
         *  string posy = Player1Cards[i].gameObject.transform.position.y.ToString();
         *  string posz = Player1Cards[i].gameObject.transform.position.z.ToString();
         *  playerCardInfo.AddCoordinatesToDatabse("1", Player1Cards[i].gameObject.name.ToString(), posx, posy, posz);
         * }
         * time1 = 0;
         */
        //}

        //if (times == 1)
        //{
        for (int i = 0; i < player2CardSize; i++)
        {
            string posx = Player2Cards[i].gameObject.transform.position.x.ToString();
            string posy = Player2Cards[i].gameObject.transform.position.y.ToString();
            string posz = Player2Cards[i].gameObject.transform.position.z.ToString();
            playerCardInfo.AddCoordinatesToDatabse("2", Player2Cards[i].gameObject.name.ToString(), posx, posy, posz);
        }
        //    time2 = 0;
        //}
    }
 // Start is called before the first frame update
 void Start()
 {
     gameNoInit = new FirebaseScript2();
     Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
         var dependencyStatus = task.Result;
         if (dependencyStatus == Firebase.DependencyStatus.Available)
         {
             Debug.Log("Firebase is ready for use.");
             firebaseReady = true;
         }
         else
         {
             firebaseReady = false;
             UnityEngine.Debug.LogError(System.String.Format(
                                            "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
             // Firebase Unity SDK is not safe to use here.
         }
     });
 }