private void InitiateVersusLocal() { player1 = new PlayerMemory (1, "ball_01", new List<string>{"ball_05", "ball_06", "ball_07"}); player2 = new PlayerMemory (2, "ball_02", new List<string>{"ball_08", "ball_09", "ball_10", "ball_13", "ball_14", "ball_15"}); player3 = new PlayerMemory (3, "ball_03", new List<string>{}); player4 = new PlayerMemory (4, "ball_04", new List<string>{"ball_11", "ball_12", "ball_09", "ball_10", "ball_05", "ball_06", "ball_08", "ball_09", "ball_10", "ball_13", "ball_08", "ball_09", "ball_10", "ball_13"}); }
private void DrawPlayerBalls(PlayerMemory player) { string message = "Player " + player.id.ToString () + ":\n"; List<string> strings = player.ballsTextures; if (strings != null && strings.Count > 0) { for (int i = 0; i < strings.Count; i++) { message += strings[i]; if (i != strings.Count - 1) message += ", "; } } EditorGUILayout.HelpBox (message, MessageType.Info); }
// Start is called before the first frame update void Start() { notif = this.transform.Find("Notif").gameObject; originalPos = notif.GetComponent <RectTransform>().anchoredPosition; //Debug.Log(notif + ""+notif.GetComponent<RectTransform>().anchoredPosition); finalPos = new Vector3(-originalPos.x, originalPos.y); notifName = this.transform.Find("Notif").Find("Content").Find("Name").GetComponent <TextApparition>(); notifDesc = this.transform.Find("Notif").Find("Content").Find("ScrollArea").Find("DescContainer").Find("Desc").GetComponent <TextApparition>(); notifScrollbar = this.transform.Find("Notif").Find("Content").Find("ScrollArea").Find("DescContainer").Find("Scrollbar").GetComponent <Scrollbar>(); playerInteractions = GameObject.FindObjectOfType <Interactions>(); playerEventsCheck = playerInteractions.GetComponent <EventsCheck>(); playerMemory = playerInteractions.GetComponent <PlayerMemory>(); stickerDisplay = CanvasManager.CManager.GetCanvas("Dialogue").transform.Find("Nouvelle Etiquette").GetComponent <NewStickerDisplay>(); playerRigidBody = playerInteractions.GetComponent <Rigidbody2D>(); MoveIndicator = this.transform.Find("MoveIndic").gameObject; }
void Update() { float h = Input.GetAxisRaw("Horizontal"); float v = Input.GetAxisRaw("Vertical"); dir = (new Vector3(h, 0, v)).normalized; if (Mathf.Abs(h) > 0) { transform.Rotate(0, Mathf.Asin(dir.x) * Mathf.Rad2Deg * turnSpeed * 0.01f, 0); } if (Input.GetButtonDown("Jump") && interaction.detecting) { PlayerMemory memory = GetComponent <PlayerMemory> (); Debug.Log("Interacting " + interaction.target.name); Transform target = interaction.target; if (!target.GetComponent <Reaction> ().IsReacting()) { Reaction.SpeechType speak; if (memory.retainingMemory) { if (memory.Recall(target.GetComponent <NPCAttrib> ().ID)) { speak = Reaction.SpeechType.FoundYou; } else { speak = Reaction.SpeechType.WrongPerson; } } else { memory.Remember(target.GetComponent <NPCAttrib> ().ID); speak = Reaction.SpeechType.PlsRememberMe; } target.GetComponent <Reaction> ().ReactTowards(transform.position, speak); } } }
private void ActiveOrDesactivePlayer(string playerName, Text player, PlayerMemory playerInMemory, PlayerMemory other0, PlayerMemory other1, PlayerMemory other2) { if (playerInMemory.isActive) { if (HasAtLeastTwoPlayersActive (other0, other1, other2)) { player.text = "none"; playerInMemory.isActive = false; } } else { if (playerInMemory.ballsTextures.Count <= 0) { ModalPanel.CallAlert (modalPanel, canvasGroup, "Jogador não tem bolinhas!", null, null); } else { player.text = playerName; playerInMemory.isActive = true; int actualBetNum = int.Parse (bet.text); if (playerInMemory.ballsTextures.Count < actualBetNum) { actualBetNum = playerInMemory.ballsTextures.Count; bet.text = actualBetNum.ToString (); } } } }
private int ComparePlayerBallsToBetNumber(int betNumber, PlayerMemory player) { if (player.ballsTextures.Count == betNumber) return 0; else if (player.ballsTextures.Count > betNumber) return 1; else return -1; }