Beispiel #1
0
 private void ShowVictoryScreen(GameManager.PlayerIndex winner)
 {
     VictoryImage.sprite = winner == GameManager.PlayerIndex.One ? playerOneImage : playerTwoImage;
     _winSound.Play();
     VictoryPanel.SetActive(true);
     PausePanel.SetActive(false);
 }
Beispiel #2
0
 public void RemovedBlock(BlockController block, GameManager.PlayerIndex player)
 {
     if (spawnedBlocks.Contains(block))
     {
         spawnedBlocks.Remove(block);
         PlayerBlocks[player].Remove(block);
         Destroy(block.gameObject);
     }
 }
Beispiel #3
0
 public void AddSpawnedBlocks(BlockController block, GameManager.PlayerIndex player)
 {
     if (block != null)
     {
         spawnedBlocks.Add(block);
         // Debug.Log(PlayerBlocks.Count);
         PlayerBlocks[player].Add(block);
         block.OnBoxDestruction += RemovedBlock;
     }
 }
    public void Activate(BlockSpawner spawner, GameManager.PlayerIndex ownerId)
    {
        blockSpawner = spawner;
        owner        = ownerId;
        switch (ownerId)
        {
        case GameManager.PlayerIndex.One:
            verticalID   = "Vertical";
            horizontalID = "Horizontal";
            break;

        case GameManager.PlayerIndex.Two:
            verticalID   = "Verticalp2";
            horizontalID = "Horizontalp2";
            break;
        }
        Active = true;
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        if (GameManager.IsPaused)
        {
            return;
        }

        if (GameManager.GetDistanceToFloor(player1.GetTopMostPoint()) > distanceToGoal)
        {
            _winner = GameManager.PlayerIndex.One;
            GameManager.CompleteGame(_winner);

            print("Spelare 1 är bäst");
        }

        if (GameManager.GetDistanceToFloor(player2.GetTopMostPoint()) > distanceToGoal)
        {
            _winner = GameManager.PlayerIndex.Two;
            GameManager.CompleteGame(_winner);
            print("Spelare 2 är bäst");
        }
    }
Beispiel #6
0
 private void ShowWinner(GameManager.PlayerIndex obj)
 {
 }
Beispiel #7
0
 public List <BlockController> GetPlayerBlocks(GameManager.PlayerIndex player)
 {
     return(PlayerBlocks[player]);
 }