//[Command] //void CmdMove() //{ // RpcMove(); //} //[ClientRpc] void RpcMove() { float fHori = Input.GetAxis("Horizontal"); float fVerti = Input.GetAxis("Vertical"); rig.AddForce(new Vector3(fHori, 0, fVerti) * speedrate); speed = rig.velocity.magnitude; inputHorizontal = Input.GetAxisRaw("Vertical"); MobileInputController mic = m_inpul_left.GetComponent <MobileInputController>(); rig.AddForce(new Vector3(mic.Coordinate().x, 0, mic.Coordinate().y) * speedrate); Vector3 from = new Vector3(0f, 0f, 1f); Vector3 to = new Vector3(m_inpul_Right.GetComponent <MobileInputController>().Horizontal, 0f, m_inpul_Right.GetComponent <MobileInputController>().Vertical); if (m_inpul_Right.GetComponent <MobileInputController>().Horizontal != 0 && m_inpul_Right.GetComponent <MobileInputController>().Vertical != 0) { float angle = Vector3.SignedAngle(from, to, Vector3.up); rotAngle = angle; transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle(transform.eulerAngles.y, angle, ref turnnSmoothVelocity, turnSmoothTime); } }
public void Init(MobilePawnComponent pawn, MobileInputController input) { _pawn = pawn; _pawn.OnDeath += PropulsionCooldown.LaForceVeloce.ResetForceVeloce; _input = input; _input.OnTouchSlowMo += PropulsionCooldown.LaForceVeloce.SlowDown; _input.OnReleaseSlowMo += PropulsionCooldown.LaForceVeloce.SlowUp; _input.OnReleaseSlowMo += FirePlayer; }
private bool SetMobile() { MobileInputController mobile = FindObjectOfType <MobileInputController>(); if (mobile == null) { mobile = AssetDatabase.LoadAssetAtPath <MobileInputController>("Assets/Dias Games/Climbing System/Prefabs/UI/Mobile Input Canvas.prefab"); MobileInputController instantiated = PrefabUtility.InstantiatePrefab(mobile) as MobileInputController; // Set character reference SerializedObject mobileSerialized = new SerializedObject(instantiated); mobileSerialized.Update(); mobileSerialized.FindProperty("m_Character").objectReferenceValue = FindObjectOfType <UnityInputManager>(); mobileSerialized.ApplyModifiedProperties(); return(true); } return(false); }
public MobilePlayerController(MobilePawnComponent pawn, MobileInputController input) { Init(pawn, input); }