// Update is called once per frame void Update() { if (!isLocalPlayer) { return; } float hAxis = Input.GetAxisRaw("Horizontal"); float vAxis = Input.GetAxisRaw("Vertical"); Vector3 movement = new Vector3(hAxis, vAxis); anim.SetFloat("Magnitude", movement.magnitude); //transform.position = transform.position + movement * movementSpeed * Time.deltaTime; if (movement.magnitude > 0) { anim.SetFloat("MoveX", movement.x); anim.SetFloat("MoveY", movement.y); rigid2D.velocity = movement * movementSpeed; ////transform.Translate(movement * movementSpeed * Time.deltaTime); } else { rigid2D.velocity = Vector2.zero; } if (Input.GetButtonDown("Fire1")) { Debug.Log("Trying to save this shit."); MySQLCS.UpdateCharacter(transform.gameObject, PlayerPrefs.GetInt("char_id")); } //if ( Input.GetAxisRaw("Horizontal") != 0f || Input.GetAxisRaw("Vertical") != 0f ) // transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * movementSpeed * Time.deltaTime, Input.GetAxisRaw("Vertical") * movementSpeed * Time.deltaTime)); }
public override void OnClientDisconnect(NetworkConnection connection) { Debug.Log(PlayerPrefs.GetFloat("last_x") + " " + PlayerPrefs.GetFloat("last_y") + " " + PlayerPrefs.GetInt("char_id") + ""); MySQLCS.UpdateCharacter(connection.playerControllers[0].gameObject, PlayerPrefs.GetInt("char_id")); }
private void OnApplicationQuit() { MySQLCS.UpdateCharacter(transform.gameObject, PlayerPrefs.GetInt("char_id")); }