void Update() { GameObject player = Utils.GetLocalPlayer(); if (player) { //draw current pickup int curLevel = player.GetComponent <PlayerPickupManager>().GetCurrentPickupLevel(); PickupType curType = player.GetComponent <PlayerPickupManager>().GetCurrentPickup(); if (curType != mPickupLastFrame || curLevel != mPickupLevelLastFrame) { int pickupImg = curLevel + (int)curType * 4; Texture pickupTex = mPickupIcons[pickupImg]; //needs to be fixed as soon as more pickup images come GameObject.Find("CurrentPickup").GetComponent <GUITexture>().enabled = true; GameObject.Find("CurrentPickup").GetComponent <GUITexture>().texture = pickupTex; } mPickupLastFrame = curType; mPickupLevelLastFrame = curLevel; //draw current spot PlayerPlace playerPlace = player.GetComponent <PlayerPlace>(); int spot = playerPlace.GetPlace(); int spottenth = (int)(spot / 10); int spotfirst = spot - spottenth * 10; string addedText = "th"; if (spottenth != 1) { if (spotfirst == 1) { addedText = "st"; } else if (spotfirst == 2) { addedText = "nd"; } else if (spotfirst == 3) { addedText = "rd"; } } GameObject.Find("CurrentSpotText").GetComponent <GUIText>().text = spot + addedText + " / " + playerPlace.GetNumPlayers(); } else { GameObject.Find("CurrentSpotText").GetComponent <GUIText>().text = ""; GameObject.Find("CurrentPickup").GetComponent <GUITexture>().enabled = false; mPickupLevelLastFrame = -1; } }
void SetScore(PlayerPlace place) { if (place == PlayerPlace.Top) { topScore++; } if (place == PlayerPlace.Bottom) { bottomScore++; } UIManager.Instance.SetScore(topScore, bottomScore); CheckGameOver(); }
void SetScore(PlayerPlace place) { if (place == PlayerPlace.Top) { topScore++; } if (place == PlayerPlace.Bottom) { bottomScore++; } UIManager.Instance.SetScore(topScore, bottomScore); client.SendData(new Score() { TopPlayerScore = topScore, BottomPlayerScore = bottomScore }); }
private void OnGoal(PlayerPlace place) { SetScore(place); }
private void OnGoal(PlayerPlace place) { SetScore(place); CheckGameOver(); }