public virtual Vector3 Move(SimpleCharacterInput input, SimpleCharacterResult current)
    {
        Vector3 velocity      = TempRigidbody.velocity;
        var     moveDirection = new Vector3(input.horizontal, 0, input.vertical);

        {
            var moveDirectionMagnitude = moveDirection.sqrMagnitude;
            if (moveDirectionMagnitude > 1)
            {
                moveDirection = moveDirection.normalized;
            }

            var targetVelocity = moveDirection * moveSpeed;

            // Apply a force that attempts to reach our target velocity
            Vector3 velocityChange = (targetVelocity - velocity);
            velocityChange.x = Mathf.Clamp(velocityChange.x, -moveSpeed, moveSpeed);
            velocityChange.y = 0;
            velocityChange.z = Mathf.Clamp(velocityChange.z, -moveSpeed, moveSpeed);
            TempRigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
        }
        if (input.isJump)
        {
            TempRigidbody.velocity = new Vector3(velocity.x, CalculateJumpVerticalSpeed(), velocity.z);
        }
        return(TempTransform.position);
    }
 private void SendInputCallback(SimpleCharacterInput inputParam)
 {
     inputList.Add(inputParam);
 }
 private void SendInput(SimpleCharacterInput input)
 {
     CallNetFunction("SendInput", DeliveryMethod.ReliableOrdered, FunctionReceivers.Server, input);
 }
 public virtual Quaternion Rotate(SimpleCharacterInput input, SimpleCharacterResult current)
 {
     TempTransform.rotation = current.rotation;
     return(TempTransform.rotation);
 }
Exemplo n.º 5
0
    void setDisableControls()
    {
        SimpleCharacterInput sci = GameObject.FindGameObjectWithTag("Player").GetComponent <SimpleCharacterInput>();

        sci.disableControls = true;
    }