private void Update() { if (Mouse.current.leftButton.isPressed) { ClientSend.PlayerShoot(new Vector3(movementX, 0.0f, movementY)); //ClientSend.PlayerShoot(camTransform.forward); } }
private void Update() { //we do this in its own update with keyGetDown to get every time a player presses the key if (Input.GetKeyDown(KeyCode.Mouse0)) { ClientSend.PlayerShoot(camTransform.forward); } }
public void WaitJump() { ClientSend.AddEffects(1); tekst.SetActive(true); inventory.instance.Remove(Item); TextCounterJump.instance.Start(); TextCounterJump.instance.Update(); Invoke("Jumpy", seconds); }
public void WaitSpeed() { ClientSend.AddEffects(3); tekst2.SetActive(true); inventory.instance.Remove(Item); TextCounterSpeed.instance.Start(); TextCounterSpeed.instance.Update(); Invoke("Speedy", seconds); }
public void WaitInvisible() { ClientSend.SetInvis(true); tekst3.SetActive(true); inventory.instance.Remove(Item); TextCounterInvisible.instance.Start(); TextCounterInvisible.instance.Update(); Invoke("Invy", seconds); }
private void Update() { manager.cursor = mainCam.ScreenToWorldPoint(Input.mousePosition); //updates mouse position if (Input.GetKeyDown(KeyCode.Mouse0)) { ClientSend.PlayerShoot(); } }
IEnumerator Wait() { ClientSend.GetRooms(); UIManager.instance.SetPlayersInRoom(new string[0]); ClientSend.GetPlayersInRoom(); yield return(new WaitForSeconds(3f)); check = true; }
private void SendMovement(Vector3 position) { using (Packet packet = new Packet((int)ClientPackets.pirateMovement)) { packet.Write(Client.instance.id); packet.Write(position); ClientSend.SendUDPData(packet); } }
void HitAnimal(GameObject animal) { int damage = 25; ClientSend.Hit("animal", animal.GetComponent<AnimalManager>().id, damage); if (animal.GetComponent<AnimalManager>().health <= damage) { ClientSend.AddItem("meat", 2); } }
void HitRock(GameObject rock) { int damage = 25; ClientSend.Hit("rock", rock.GetComponent<Rock>().id, damage); if (rock.GetComponent<Rock>().hp <= damage) { ClientSend.AddItem("rock", 2); } }
private void SendAudioToServer() { AudioSource audioSource = GetComponent <AudioSource>(); float[] samples = new float[audioSource.clip.samples * audioSource.clip.channels]; audioSource.clip.GetData(samples, 0); ClientSend.PlayerAudio(samples); }
public static void Welcome(Packet packet) { string msg = packet.ReadString(); int myid = packet.ReadInt(); Debug.Log("Welcome Message received " + msg); Client.Instance.myId = myid; ClientSend.WelcomeReceived(); }
private static void SendMessage(string buttonName) { if (Client.Instance.isConnected) { Log(_chatInput.GetText()); ClientSend.Chat(Client.Instance.myId, _chatInput.GetText()); } MultiplayerClient.Instance.herochat.text = _chatInput.GetText(); }
private void SendInputToServer() { bool[] _inputs = new bool[] { Input.GetKey(KeyCode.Mouse0) }; print(EventSystem.current.currentSelectedGameObject.name); ClientSend.PlayerMovement(_inputs); }
public static void Welcome(Packet _packet) { string _msg = _packet.ReadString(); int _myId = _packet.ReadInt(); Debug.Log($"Message from server: {_msg}"); Client.instance.myId = _myId; ClientSend.WelcomeReceived(); }
public static void Welcome(Packet _packet) { string _msg = _packet.ReadString(); int _myId = _packet.ReadInt(); Console.WriteLine($"Message from server: {_msg}"); Client.myId = _myId; ClientSend.WelcomeReceived(); }
public void OnMouseDown() { clicksRecorded++; ClientSend.BoxClicked(id); if (clicksRecorded >= clickCapacity) { gameObject.SetActive(false); } }
public void OnTriggerStay(Collider other) { if (getKeyDownF) { getKeyDownF = false; //문열기 if (other.CompareTag("Door")) { if (other.gameObject.transform.rotation.y == 0f) { other.gameObject.transform.RotateAround(other.gameObject.transform.GetChild(0).position, Vector3.up, -90f); } else { other.gameObject.transform.RotateAround(other.gameObject.transform.GetChild(0).position, Vector3.up, 90f); } } //은폐 if (isInHideZone) { ClientSend.Hide(other.gameObject); } //아이템획득 if (other.CompareTag("Item")) { if (other.GetComponent <ItemSpawner>().hasItem) { switch (other.GetComponent <ItemSpawner>().itemType) { case ItemType.GUN: case ItemType.DRONE: if (this.GetComponent <PlayerManager>().playerItem.item_number1 == null) { ClientSend.PlayerGetItem(other.gameObject); } else { Debug.Log($"해당 아이템은 1개만 획득할 수 있습니다"); } break; default: ClientSend.PlayerGetItem(other.gameObject); break; } } else { Debug.Log($"주위에 아무것도 없습니다"); } } else { Debug.Log($"주위에 아무것도 없습니다"); } } }
private void ChangeTeam() { using (Packet packet = new Packet((int)ClientPackets.changeTeam)) { packet.Write(Client.instance.id); packet.Write(team.id); ClientSend.SendTCPData(packet); } }
IEnumerator AnswerDelay() { yield return(new WaitForSeconds(3)); ClientSend.ColorRequest(); waktu = 10; //ss.playerAnswer = false; Debug.Log("Second"); }
/// <summary> /// 连接到服务端后收到Welcome消息 /// </summary> /// <param name="_packet">Packet包含:消息字串,ID</param> public static void Welcome(Packet _packet) { string _msg = _packet.ReadString(); int _myId = _packet.ReadInt(); Console.WriteLine($"Message from server: {_msg}"); Client.instance.myId = _myId; ClientSend.WelcomeReceived(); Client.instance.udp.Connect(((IPEndPoint)Client.instance.tcp.socket.Client.LocalEndPoint).Port); }
private void Update() { if (Input.GetKeyDown(KeyCode.Mouse1) && localPlayerController.IsAlive() && readyToThrow) { readyToThrow = false; ClientSend.PlayerThrowItem(camTransform.forward); //audioManager.Throw(); FIX THIS StartCoroutine(ThrowCooldown()); } }
protected override void Awake() { base.Awake(); CanMove = true; currentStamina = MaxStamina; ClientSend.PlayerMovementStats(RunSpeed, SprintSpeed); PlatformLayer = LayerMask.NameToLayer(PlatformLayerName); }
public void TakeDamage(int damage, int bulletOwnerID) { if (CurrentHealth - damage <= 0) { Die(bulletOwnerID); } PlayerManager.TookDamage(damage, CurrentHealth - damage); ClientSend.TookDamage(damage, CurrentHealth); }
public void SendBuilding(SendBuildingSignal signal) { Debug.Log("Send buildoing to server: " + signal.Building.Name); JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; string json = JsonConvert.SerializeObject(signal.Building, settings); ClientSend.SendJsonPackage(json); }
private void LoginButton_Click(object sender, RoutedEventArgs e) { string username = Username.Text; string password = Password.Password; ClientSend.SendLoginData(username, password); //var glWindow = new GLwindow(); //glWindow.Show(); //this.Close(); }
private void ShootBullet() { if (!CanShoot) { return; } PlayerManager.CallOnBulletShotEvent(FirePointTransform.position, FirePointTransform.rotation); //base.ShootBullet(FirePointTransform.position, FirePointTransform.rotation); ClientSend.ShotBullet(FirePointTransform.position, FirePointTransform.rotation); }
/// <summary>Takes a shot in semi-automatic mode.</summary> /// <param name="_shootDirection">The vector that the shot will travel.</param> public void SemiShot(Vector3 _shootDirection) { ClientSend.PlayerShoot(_shootDirection); isNextShotReady = false; if (!preparingNextShot) { StartCoroutine(PrepareNextShot()); } }
private void SendInputToServer() { bool[] _inputs = new bool[] { Input.GetKey(KeyCode.Z), Input.GetKey(KeyCode.S), Input.GetKey(KeyCode.Q), Input.GetKey(KeyCode.D) }; ClientSend.PlayerMovement(_inputs); }
void OnTriggerStay2D(Collider2D aaa) { if (gameObject.tag == "LocalPlayer") { if (aaa.gameObject.tag == "Water" && Input.GetKeyDown(KeyCode.Space)) { ClientSend.CharacterStatus((int)CharacterStats.Water); } } }