void HandleAttack(SocketIOEvent e) { //Debug.Log("handleAttack"); //Debug.Log(e.data); PlayerAttackStruct attackMessage = JsonUtility.FromJson <PlayerAttackStruct>(e.data); Vector3 turretRotation = new Vector3(attackMessage.x, attackMessage.y, attackMessage.z); GameManager.instance.OnPlayerAttack(attackMessage.id, attackMessage.force, turretRotation); }
public void NotifyPlayerAttack(string playerId, float force, Vector3 turretRotation) { PlayerAttackStruct attackMessage = new PlayerAttackStruct(playerId, turretRotation.x, turretRotation.y, turretRotation.z, force); io.Emit("attack", JsonUtility.ToJson(attackMessage)); }