private void DisplayPlayers(bool isMatchOver, string winnerName) { _winnerImage = null; if (isMatchOver) { m_TopText.text = Database.instance.GameTexts[14] + winnerName; m_MatchMenu.SetActive(true); m_ListOfButtones[m_currentSelection].Select(); } else { m_TopText.text = Database.instance.GameTexts[13] + winnerName; m_RoundMenu.SetActive(true); } for (int i = 0; i < m_ListOfPlayerLines.Count; i++) { if (i < PlayerSpawner.instance.ListOfPlayerDatas.Count) { m_ListOfPlayerLines[i].SetActive(true); Text textTrans = m_ListOfPlayerLines[i].transform.FindChild("PlayerName").gameObject.GetComponent <Text>(); textTrans.text = PlayerSpawner.instance.ListOfPlayerDatas[i].PlayerSponsor.SponsorName; textTrans.color = PlayerSpawner.instance.ListOfPlayerDatas[i].PlayerSponsor.SponsorColor; Transform ParentToUse = m_ListOfPlayerLines[i].transform.FindChild("Circles"); PlayerScoreTracker currentPlayerScore = ScoreManager.instance.GetScoreData(PlayerSpawner.instance.ListOfPlayerDatas[i]); int x = 0; foreach (Transform child in ParentToUse) { Image toChange = child.GetComponent <Image>(); if (x < Database.instance.AmountOfRounds) { child.gameObject.SetActive(true); if (currentPlayerScore != null) { if (winnerName == currentPlayerScore.Player.PlayerSponsor.SponsorName && x == currentPlayerScore.CurrentScore - 1) { _winnerImage = toChange; } else if (x < currentPlayerScore.CurrentScore) { toChange.sprite = m_Circles[1]; } } } else { child.gameObject.SetActive(false); } x++; } } } }
// Use this for initialization void Start() { if (instance != null) { Destroy(this); } else { instance = this; } streakText.text = ""; }
protected virtual void Awake() { Health = maxHealth; IsDead = false; scoreTracker = GetComponent <PlayerScoreTracker>(); nStoredDate = NetworkStoredData.instance; if (headPlacement != null) { GameObject go = new GameObject("Head Collider"); go.transform.position = transform.position; HeadEntity newHead = go.AddComponent <HeadEntity>(); newHead.SetUp(headPlacement, transform, this); } }
public void SendGoalUpdate(GameObject ball) { if (_myID != 0) { return; } ball.GetComponent <Rigidbody>().velocity = Vector3.zero; ball.transform.position = RespawnManager.instance.GetRandonBallRespawnLocation(); int ballID = ball.transform.GetSiblingIndex(); PlayerScoreTracker scoreTracker = _players[ballID].GetComponent <PlayerScoreTracker>(); scoreTracker.ConvertPoints(); SendScoreInfo(ballID, scoreTracker.CurrentStrokes, scoreTracker.PersonalBest, scoreTracker.Kills, scoreTracker.Deaths); }
public void SendUpdatedScore(int id) { PlayerScoreTracker score = _players[id].GetComponent <PlayerScoreTracker>(); SendScoreInfo(id, score.CurrentStrokes, score.PersonalBest, score.Kills, score.Deaths); }