public void SetColorAfterWhot(string color) { colorinfopanel.SetActive(true); colorname.text = WhotConstants.GetColorFolder(color); int soundId = -1; switch (colorname.text) { case "Circle": soundId = (int)ListOfSounds.Circle; break; case "Triangle": soundId = (int)ListOfSounds.Triangle; break; case "Crosses": soundId = (int)ListOfSounds.Crosses; break; case "Square": soundId = (int)ListOfSounds.Square; break; case "Star": soundId = (int)ListOfSounds.Star; break; } if (soundId != -1) { SoundManger.instance.PlaySound(soundId); } }
public void AddCardInPileList(string id) { CardTumb card = (WhotConstants.CreateDuplicate(pileCardTumb.gameObject)).GetComponent <CardTumb>(); card.GetComponent <RectTransform>().sizeDelta = new Vector2(190f, 250f); card.name = id; if (!WhotManager.instance.pileCardIds.Contains(id)) { WhotManager.instance.pileCardIds.Add(id); } card.SetCardName(id, false); card.transform.localPosition = new Vector3(pileCardTumb.transform.localPosition.x, pileCardTumb.transform.localPosition.y, pileZPos); pileZPos -= 0.01f; }
// Use this for initialization public void InitiateGame() { if (intiateGame) { return; } intiateGame = true; Debug.Log("Initiating Game!!"); WhotConstants.SetColorFolderDic(); PlayerPrefs.SetInt("PickTwo", 0); PlayerPrefs.SetInt("PickThree", 0); if (!WhotConstants.isAI) { isOnlineMode = true; WhotUiManager.instance.resultDisplayed = false; myRemainingLives.transform.parent.gameObject.SetActive(true); opponentRemainingLives.transform.parent.gameObject.SetActive(true); if (WHOTMultiplayerManager.Instance.myTurn == 0) { //StartTimer (); //*commented before modification WhotManager.instance.turnMsg.SetActive(true); myTurn = 0; playerTurn = true; AddCardsInPile(); Debug.Log("Distribute cards under whotmanager 285"); Invoke("DistributeCards", 1); UpdateUserAreaAndMsg(); //WHOTMultiplayerManager.instance.SendProfile(); //No need to send profile as we are getting info from photon } else { WhotManager.instance.turnMsg.SetActive(false); myTurn = 1; playerTurn = false; //DistributeForSecondPlayer(); //Invoke ("AddOneCardInPlayedList", 1.1f); } StartCoroutine(ResetUIForGame()); } else { myRemainingLives.transform.parent.gameObject.SetActive(false); opponentRemainingLives.transform.parent.gameObject.SetActive(false); } }
void ShowImageOnCard(string cardName, bool show) { string colorKey = cardName.Substring(0, 3); string cardNum = cardName.Substring(3, cardName.Length - 3); string folderName = WhotConstants.GetColorFolder(colorKey); cardMaterial.mainTexture = Resources.Load <Texture>("cards/" + folderName + "/" + cardNum); if (show) { card.transform.localRotation = Quaternion.Euler(0, 180f, 0); } else { card.transform.localRotation = Quaternion.Euler(0, 0f, 0); } }
/// <summary> /// Updates the displayed cards. /// </summary> /// <param name="userCards">User cards.</param> public int UpdateCardTumb(List <string> userCards, bool showCard) { Transform parent = tumb.transform.parent; int sumOfCards = 0; for (int i = 1; i < parent.childCount; i++) { Destroy(parent.GetChild(i).gameObject); } foreach (string id in userCards) { CardTumb card = (WhotConstants.CreateDuplicate(tumb.gameObject)).GetComponent <CardTumb>(); card.name = id; card.SetCardName(id, showCard); int cardNumPlayed = int.Parse(id.Substring(3, id.Length - 3)); sumOfCards += cardNumPlayed; } return(sumOfCards); }
public void OnStart() { WhotConstants.SetColorFolderDic(); if (WhotConstants.isAI) { isOnlineMode = false; AddCardsInPile(); Debug.Log("Distribute cards under whotmanager"); Invoke("DistributeCards", 1); UpdateUserAreaAndMsg(); List <string> AINames = new List <string> { "Rainbow", "Sunshine", "Marigold" }; CPUName.text = AINames[UnityEngine.Random.Range(0, 2)]; PlayerNameText.text = UserDetailsManager.userName; chatOptions.SetActive(false); } }
public void AddCardInPlayedList(string id) { CardTumb card = (WhotConstants.CreateDuplicate(playedCardTumb.gameObject)).GetComponent <CardTumb>(); card.name = id; if (!WhotManager.instance.playedCardIds.Contains(id)) { WhotManager.instance.playedCardIds.Add(id); } card.SetCardName(id); card.transform.localPosition = new Vector3(playedCardTumb.transform.localPosition.x, playedCardTumb.transform.localPosition.y, playedCardZPos); card.transform.localRotation = Quaternion.Euler(0f, 0f, Random.Range(0, 359f)); playedCardZPos -= 0.01f; if (playedparent.transform.childCount > 3) { Transform lastPlayedCard = playedparent.GetChild(playedparent.transform.childCount - 2); GameObject fbxCard = lastPlayedCard.Find("whot").gameObject; fbxCard.GetComponent <MeshRenderer>().material = standardMat; } }