// Start is called before the first frame update
    void Start()
    {
        win  = Resources.Load <Sprite>("grey_boxCheckmark");
        lose = Resources.Load <Sprite>("grey_boxCross");

        string nickname = PlayerPrefs.GetString("player");

        player = DatabaseDataAcces.getPlayerWithNickname(nickname);

        games = DatabaseDataAcces.getGamesPlayed(player.id);

        for (int i = games.Count - 1; i >= 0; i--)
        {
            GamePlayed g = games[i];

            GameObject item    = Instantiate(prefab);
            Image      image   = item.transform.Find("Image").GetComponent <Image>();
            Text       player2 = item.transform.Find("player2").GetComponent <Text>();

            if (g.winner == 1)
            {
                image.sprite = win;
            }
            else
            {
                image.sprite = lose;
            }

            player2.text = g.secondPlayer.nickname;



            item.transform.SetParent(content.transform, false);
        }
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        oneStar        = Resources.Load <Sprite>("one-star");
        twoStars       = Resources.Load <Sprite>("two-stars");
        threeStars     = Resources.Load <Sprite>("three-stars");
        bladeSprite    = Resources.Load <Sprite>("blade");
        chainsawSprite = Resources.Load <Sprite>("chainsaw");
        chassis1Sprite = Resources.Load <Sprite>("chassis_1");
        chassis2Sprite = Resources.Load <Sprite>("chassis_2");
        chassis3Sprite = Resources.Load <Sprite>("chassis_3");
        forkliftSprite = Resources.Load <Sprite>("forklift");
        rocketSprite   = Resources.Load <Sprite>("rocket");
        stingerSprite  = Resources.Load <Sprite>("stinger");
        wheel1Sprite   = Resources.Load <Sprite>("wheel_1");
        wheel2Sprite   = Resources.Load <Sprite>("wheel_2");

        string nickname = PlayerPrefs.GetString("player");

        player = DatabaseDataAcces.getPlayerWithNickname(nickname);

        ItemDropHandler dropHandler;

        dropHandler           = attack1Place.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 4;
        dropHandler.subtype   = 1;

        dropHandler           = attack2Place.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 4;
        dropHandler.subtype   = 2;

        dropHandler           = forkliftPlace.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 3;

        dropHandler           = frontWheelPlace.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 2;
        dropHandler.subtype   = 1;

        dropHandler           = backWheelPlace.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 2;
        dropHandler.subtype   = 2;

        dropHandler           = chassisPlace.AddComponent <ItemDropHandler>();
        dropHandler.modifyCar = this;
        dropHandler.type      = 1;

        LoadItems();

        LoadCar();
    }
Beispiel #3
0
    public void AddPlayerButton()
    {
        string nick  = nickname.text;
        string first = firstName.text;
        string last  = lastName.text;
        int    a     = int.Parse(age.text);


        Player p = DatabaseDataAcces.getPlayerWithNickname(nick);

        if (p == null)
        {
            p           = new Player();
            p.nickname  = nick;
            p.firstName = first;
            p.lastName  = last;
            p.age       = a;

            DatabaseDataAcces.insertPlayer(p);
        }

        p = DatabaseDataAcces.getPlayerWithNickname(nick);

        int chassisId = DatabaseDataAcces.InsertHasCarPart(p.id, 1, 1);
        int attackId  = DatabaseDataAcces.InsertHasCarPart(p.id, 7, 1);
        int wheelId   = DatabaseDataAcces.InsertHasCarPart(p.id, 5, 1);
        int wheel2Id  = DatabaseDataAcces.InsertHasCarPart(p.id, 5, 1);

        HasCarPart chassis = DatabaseDataAcces.getHasCarPart(chassisId);
        HasCarPart attack  = DatabaseDataAcces.getHasCarPart(attackId);
        HasCarPart wheel   = DatabaseDataAcces.getHasCarPart(wheelId);
        HasCarPart wheel2  = DatabaseDataAcces.getHasCarPart(wheel2Id);

        DatabaseDataAcces.InsertPlayerCar(p.id);

        DatabaseDataAcces.changePart(chassis, 1);
        DatabaseDataAcces.changePart(attack, 1);
        DatabaseDataAcces.changePart(wheel, 1);
        DatabaseDataAcces.changePart(wheel2, 2);

        DatabaseDataAcces.insertBox(p.id, 0);
        DatabaseDataAcces.insertBox(p.id, 0);

        SceneManager.LoadScene("StartupScene");
    }
    // Start is called before the first frame update
    void Start()
    {
        oneStar    = Resources.Load <Sprite>("one-star");
        twoStars   = Resources.Load <Sprite>("two-stars");
        threeStars = Resources.Load <Sprite>("three-stars");

        string nickname = PlayerPrefs.GetString("player");

        player = DatabaseDataAcces.getPlayerWithNickname(nickname);

        int lastWon = DatabaseDataAcces.getNumberofWonInRow(player.id) % 3;

        nextBoxImage.fillAmount = (lastWon * 1f) / 3.0f;
        nextBoxText.text        = lastWon + " / 3 Won";

        LoadBoxes();

        LoadCar();
    }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        moveWalls           = false;
        playerHittingWall   = false;
        opponentHittingWall = false;
        lastHPChangeTime    = Time.time;
        playerControls      = PlayerPrefs.GetInt("controls") == 1;

        string nickname = PlayerPrefs.GetString("player");

        player = DatabaseDataAcces.getPlayerWithNickname(nickname);

        winnerText.gameObject.SetActive(false);
        goToGarage.gameObject.SetActive(false);
        winnerBackground.gameObject.SetActive(false);

        GetOpponent();

        playerName.text   = player.nickname;
        opponentName.text = opponent.nickname;

        LoadCars();
        IgnoreCollisions();
    }