Esempio n. 1
0
 public override void InitPointsUI()
 {
     if (GameController.Instance != null && MinigameController.Instance != null)
     {
         PointSystem gameControllerPointsystem = new PointSystem();
         if (IsPointsBased)
         {
             gameControllerPointsystem.InitializePlayers(GameController.Instance.Players);
         }
         else
         {
             gameControllerPointsystem = GameController.Instance.PointSystem;
         }
         var minigameControllerPointSystem = MinigameController.Instance.MinigamePointSystem;
         foreach (var item in GameController.Instance.Players)
         {
             PlayerScore ps = Instantiate(playerScorePrefab, transform);
             playerScores.Add(ps);
             ps.Player             = item;
             ps.PlayerImage.sprite = playerSprites[item.ID];
             ps.UpdatePoints(gameControllerPointsystem.GetCurrentScore()[item], minigameControllerPointSystem.GetCurrentScore()[item]);
         }
         UpdatePlacements();
         if (!IsPointsBased)
         {
             GameController.Instance.PointSystem.UpdateScore(minigameControllerPointSystem.GetCurrentScore());
         }
         StartCoroutine("UpdatePlacement");
     }
 }
Esempio n. 2
0
 public void InitPinataSection(PointSystem pointSystem)
 {
     foreach (var item in pointSystem.GetCurrentScore())
     {
         List <GameObject> pinatas = new List <GameObject>();
         playerPinatas.Add(item.Key.PlayerObject, pinatas);
         for (int i = 0; i < item.Value; i++)
         {
             playerPinatas[item.Key.PlayerObject].Add(SpawnPinata(item.Key.ID));
         }
     }
 }
Esempio n. 3
0
    private void StartGame(BaseEventInfo e)
    {
        var         sortedList  = SortByAscending(GameController.Instance.PointSystem.GetCurrentScore());
        PointSystem pointSystem = new PointSystem();

        pointSystem.InitializePlayers(GameController.Instance.Players);
        KeyValuePair <Player, int> previousScore = new KeyValuePair <Player, int>(new Player(), int.MinValue);
        int leadMultiplier = 1;

        foreach (var item in sortedList)
        {
            if (item.Value == previousScore.Value)
            {
                pointSystem.GetCurrentScore()[item.Key] = pointSystem.GetCurrentScore()[previousScore.Key];
            }
            else
            {
                pointSystem.GetCurrentScore()[item.Key] = leadMultiplier;
            }
            leadMultiplier++;
            previousScore = item;
        }
        pinataSpawner.GetComponent <FinalePinataSection>().InitPinataSection(pointSystem);
    }
Esempio n. 4
0
 public override void InitPointsUI()
 {
     if (GameController.Instance != null)
     {
         PointSystem gameControllerPointsystem = new PointSystem();
         gameControllerPointsystem = GameController.Instance.PointSystem;
         foreach (var item in GameController.Instance.Players)
         {
             PlayerScore ps = Instantiate(playerScorePrefab, transform);
             playerScores.Add(ps);
             ps.Player             = item;
             ps.PlayerImage.sprite = playerSprites[item.ID];
             ps.UpdateFinalScore(gameControllerPointsystem.GetCurrentScore()[item]);
         }
         UpdatePlacements();
     }
 }
Esempio n. 5
0
    private void AssignPodiums()
    {
        PointSystem ps     = GameController.Instance.PointSystem;
        var         sorted = from playerScore
                             in ps.GetCurrentScore()
                             orderby - playerScore.Value
                             select playerScore;
        var sortedList    = sorted.ToList();
        int placement     = 0;
        int previousScore = 0;

        foreach (var player in sortedList)
        {
            if (player.Value == previousScore)
            {
                placement--;
            }
            GameObject podiumPrefab = podiumPrefabs[placement];
            var        podium       = Instantiate(podiumPrefab, podiumPlacements[player.Key.ID].position, podiumPrefab.transform.rotation);
            podium.GetComponent <Podium>().ElevatePodium();
            placement++;
            previousScore = player.Value;
        }
    }