public virtual void SetInfo(PlayerData playerData) { Init(); NamePlayer = playerData.NamePlayer; if (NamePlayer.Length <= 6) { txt_name.text = NamePlayer; } else { txt_name.text = NamePlayer.Substring(0, 6) + ".."; } SetMoney(playerData.Money); IsMaster = playerData.IsMaster; IsReady = playerData.IsReady; SetShowMaster(IsMaster); LoadAssetBundle.LoadSprite(img_avata, BundleName.AVATAS, playerData.Avata_Id + ""); if (IsMaster) { SetShowReady(false); } else { SetShowReady(IsReady); } }
private void OnCollisionEnter2D(Collision2D collision) { Vector3 positionBall = this.transform.position; float scalePaddleX = collision.transform.localScale.x; float scalePaddleY = collision.transform.localScale.y; if (collision.collider.gameObject.CompareTag("Player")) { Player player = collision.collider.GetComponent <Player>(); PlayerHitted = player.NamePlayer; Debug.Log("giocatore che ha colpito la palla: " + PlayerHitted); if (positionBall.y > scalePaddleY + positionBall.y && scalePaddleY + positionBall.y < positionBall.y) { rbBall.velocity = new Vector2(1, -1); } } else if (collision.collider.gameObject.CompareTag("Y_Wall")) { audioSource.PlayOneShot(sfxWall); float directionX = collision.transform.localScale.x; float directionY = collision.transform.localScale.y; if (positionBall.y >= directionY + positionBall.y && directionY + positionBall.y <= positionBall.y) { rbBall.velocity = new Vector2(1, -1); } } }
public void Execute(object parameter) { var v = parameter as ViewModel; var pList = new NamesOfPlayers(); foreach (var n in v.NamesDownloaded) { var np = new NamePlayer() { Name = n.Content.ToString() }; pList.NamePlayersList.Add(np); } var xmlSerializer = new XmlSerializer(typeof(NamesOfPlayers)); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "XML-File | *.xml"; if (saveFileDialog.ShowDialog() == true) { xmlSerializer.Serialize(File.Create(saveFileDialog.FileName), pList); } }
private void Awake() { rb = this.GetComponent <Rigidbody2D>(); col = this.GetComponent <Collider2D>(); rb.isKinematic = true; isActived = false; playerNameTaked = NamePlayer.None; }
public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>(); NamePlayer tank = gamePlayer.GetComponent <NamePlayer>(); tank.m_playerName = lobby.playerName; }
public void ChatAction() { if (NamePlayer.Equals(ClientConfig.UserInfo.UNAME)) { return; } // if (!chatAction.isShow()) { // chatAction.OnShowAction(); // } else { // chatAction.OnHideAction(); // } }
public MyEventArgs(GameObject sender, NamePlayer namePlayer) { this.sender = sender; this.namePlayer = namePlayer; this.myFloat = 0; this.mySecondFloat = 0; this.myInt = 0; this.mySecondInt = 0; this.myBool = false; this.mySecondBool = false; this.myString = string.Empty; }
private void OnTriggerEnter(Collider objectHitted) { if (objectHitted.gameObject.CompareTag("Y_Wall") || objectHitted.gameObject.CompareTag("X_Wall")) { objectHitted.gameObject.SetActive(false); objectHitted.transform.position = Vector3.zero; } if (objectHitted.gameObject.CompareTag("Ball")) { Ball playerHitted = objectHitted.GetComponent <Ball>(); playerNameTaked = playerHitted.PlayerHitted; if (typeWeapon == TypeWeapon.Bomb) { ActivateAutoDestruction(WeaponData.GetTimeAutoDestruction); } } }
private IEnumerator DisableRespawn(float timeToRespawn, NamePlayer namePlayer) { yield return(new WaitForSeconds(timeToRespawn)); if (namePlayer == NamePlayer.PlayerLeft) { barLeftPlayer.gameObject.SetActive(true); iconPlayerLeftRespawn.SetActive(false); } if (namePlayer == NamePlayer.PlayerRight) { barRightPlayer.gameObject.SetActive(true); iconPlayerRightRespawn.SetActive(false); } EventManager.instance.CastEvent(MyIndexEvent.spawnPlayer, new MyEventArgs() { sender = gameObject, namePlayer = namePlayer }); }