コード例 #1
0
    public void Win()
    {
        canvas.enabled = true;
        gameOver       = true;
        StockSave     ss              = FindObjectOfType <StockSave>();
        int           bestPlayer      = 1;
        int           actualBestScore = 0;
        PlayerManager pm              = FindObjectOfType <PlayerManager>();

        foreach (KeyValuePair <int, int> kvp in ss.playerScore)
        {
            if (kvp.Value > actualBestScore)
            {
                bestPlayer      = kvp.Key;
                actualBestScore = kvp.Value;
            }
            GameObject.Find("PV" + kvp.Key).GetComponent <VictoryUI>().updateUI(kvp.Value, pm.playerList[kvp.Key]);
        }

        GameObject.Find("PV" + bestPlayer).GetComponent <VictoryUI>().Crown();

        for (int i = 0; i < 4 - pm.playerList.Count; i++)
        {
            GameObject.Find("PV" + (4 - i).ToString()).gameObject.SetActive(false);
        }
    }
コード例 #2
0
 private IEnumerator SaveApples(StockSave stock, int playerIndex)
 {
     while (true)
     {
         SaveApple(stock, playerIndex);
         yield return(new WaitForSeconds(stockDelay));
     }
 }
コード例 #3
0
 public void OnStockCollision(StockSave stock, int playerIndex)
 {
     if (_apples.Count > 0)
     {
         saveApplesCoroutine = StartCoroutine(SaveApples(stock, playerIndex));
         _stockingApples     = true;
     }
 }
コード例 #4
0
    public void SaveApple(StockSave stock, int playerIndex)
    {
        GameObject savedApple = _apples.Pop();

        if (_apples.Count == 0)
        {
            if (saveApplesCoroutine != null)
            {
                StopCoroutine(saveApplesCoroutine);
            }
            _stockingApples = false;
        }
        stock.AddApple(savedApple, playerIndex);
    }