public void OnClick(RaycastHit hit) { Navigator navPos = player.GetComponent <Navigator>(); NetworkMove netMove = player.GetComponent <NetworkMove>(); navPos.NavigateTo(hit.point); netMove.OnMove(hit.point); }
//NORMAL MOVE() public void Move() { float moveHorizontal = Input.GetAxisRaw("Horizontal"); rb.velocity = new Vector2(moveHorizontal * playerSpeed, rb.velocity.y); //Handle facing left/right if (moveHorizontal != 0 && (moveHorizontal < 0) != transform.localScale.x < 0) { Flip(); } //Send new position netMove.OnMove(transform); }
public void Start() { transform.position = PlayerManager.RandomPosition(); currentHealth = maxHealth; healthbarWidth = healthbar.rectTransform.sizeDelta.x; agent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); netMove = GetComponent <NetworkMove>(); if (isLocal) { controller.onRayHit += (hit) => { agent.SetDestination(hit.point); netMove.OnMove(hit.point); }; netMove.Initialize(); idTM.text = PlayerData.schema.name; } }