public void ReceivePlayerInfos(int[] playerIds, string[] playerNames, int[] playerLevels, int[] equipedWeaponTypeIds, float[] playerPositions) { if (IsConnected) { Vector3[] positions = new Vector3[playerIds.Length]; for (int i = 0; i < playerIds.Length; i++) { float[] pos = new float[] { playerPositions[i * 3], playerPositions[i * 3 + 1], playerPositions[i * 3 + 2] }; positions[i] = UnityTools.ArrayToVector3(pos); } ClientReceiveEvent clientReceiveEvent = new ClientReceiveEvent(); clientReceiveEvent.SetData(new object[] { ClientReceiveEvent.Type_ReceivePlayerInfos, playerIds, playerNames, playerLevels, equipedWeaponTypeIds, positions }); EventManager.Instance.PublishEvent(clientReceiveEvent); } }
public void ReceiveMovement(int playerId, float[] target) { if (IsConnected) { ClientReceiveEvent clientReceiveEvent = new ClientReceiveEvent(); clientReceiveEvent.SetData(new object[] { ClientReceiveEvent.Type_ReceiveMovement, playerId, UnityTools.ArrayToVector3(target) }); EventManager.Instance.PublishEvent(clientReceiveEvent); } }
public void AddPlayer(int playerId, string playerName, int playerLevel, int equipedWeaponTypeId, float[] position) { if (IsConnected) { ClientReceiveEvent clientReceiveEvent = new ClientReceiveEvent(); clientReceiveEvent.SetData(new object[] { ClientReceiveEvent.Type_AddPlayer, playerId, playerName, playerLevel, equipedWeaponTypeId, UnityTools.ArrayToVector3(position) }); EventManager.Instance.PublishEvent(clientReceiveEvent); } }