Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

@@ -1,115 +1,115 @@
using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

namespace UnityStandardAssets.Characters.FirstPerson
{
[Serializable]
public class MouseLook
{
public float XSensitivity = 2f;
public float YSensitivity = 2f;
public bool clampVerticalRotation = true;
public float MinimumX = -90F;
public float MaximumX = 90F;
public bool smooth;
public float smoothTime = 5f;
public bool lockCursor = true;


private Quaternion m_CharacterTargetRot;
private Quaternion m_CameraTargetRot;
private bool m_cursorIsLocked = true;

public void Init(Transform character, Transform camera)
{
m_CharacterTargetRot = character.localRotation;
m_CameraTargetRot = camera.localRotation;
}


public void LookRotation(Transform character, Transform camera)
{
float yRot = CrossPlatformInputManager.GetAxis("Mouse X") * XSensitivity;
float xRot = CrossPlatformInputManager.GetAxis("Mouse Y") * YSensitivity;

m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);

if(clampVerticalRotation)
m_CameraTargetRot = ClampRotationAroundXAxis (m_CameraTargetRot);

if(smooth)
{
character.localRotation = Quaternion.Slerp (character.localRotation, m_CharacterTargetRot,
smoothTime * Time.deltaTime);
camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot,
smoothTime * Time.deltaTime);
}
else
{
character.localRotation = m_CharacterTargetRot;
camera.localRotation = m_CameraTargetRot;
}

UpdateCursorLock();
}

public void SetCursorLock(bool value)
{
lockCursor = value;
if(!lockCursor)
{//we force unlock the cursor if the user disable the cursor locking helper
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}

public void UpdateCursorLock()
{
//if the user set "lockCursor" we check & properly lock the cursos
if (lockCursor)
InternalLockUpdate();
}

private void InternalLockUpdate()
{
if(Input.GetKeyUp(KeyCode.Escape))
{
m_cursorIsLocked = false;
}
else if(Input.GetMouseButtonUp(0))
{
m_cursorIsLocked = true;
}

if (m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
else if (!m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}

Quaternion ClampRotationAroundXAxis(Quaternion q)
{
q.x /= q.w;
q.y /= q.w;
q.z /= q.w;
q.w = 1.0f;

float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan (q.x);

angleX = Mathf.Clamp (angleX, MinimumX, MaximumX);

q.x = Mathf.Tan (0.5f * Mathf.Deg2Rad * angleX);

return q;
}

}
}
using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

namespace UnityStandardAssets.Characters.FirstPerson
{
[Serializable]
public class MouseLook
{
public float XSensitivity = 2f;
public float YSensitivity = 2f;
public bool clampVerticalRotation = true;
public float MinimumX = -90F;
public float MaximumX = 90F;
public bool smooth;
public float smoothTime = 5f;
public bool lockCursor = true;


private Quaternion m_CharacterTargetRot;
private Quaternion m_CameraTargetRot;
private bool m_cursorIsLocked = true;

public void Init(Transform character, Transform camera)
{
m_CharacterTargetRot = character.localRotation;
m_CameraTargetRot = camera.localRotation;
}


public void LookRotation(Transform character, Transform camera)
{
float yRot = CrossPlatformInputManager.GetAxis("Mouse X") * XSensitivity;
float xRot = CrossPlatformInputManager.GetAxis("Mouse Y") * YSensitivity;

m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);

if(clampVerticalRotation)
m_CameraTargetRot = ClampRotationAroundXAxis (m_CameraTargetRot);

if(smooth)
{
character.localRotation = Quaternion.Slerp (character.localRotation, m_CharacterTargetRot,
smoothTime * Time.deltaTime);
camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot,
smoothTime * Time.deltaTime);
}
else
{
character.localRotation = m_CharacterTargetRot;
camera.localRotation = m_CameraTargetRot;
}

UpdateCursorLock();
}

public void SetCursorLock(bool value)
{
lockCursor = value;
if(!lockCursor)
{//we force unlock the cursor if the user disable the cursor locking helper
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}

public void UpdateCursorLock()
{
//if the user set "lockCursor" we check & properly lock the cursos
if (lockCursor)
InternalLockUpdate();
}

private void InternalLockUpdate()
{
if(Input.GetKeyUp(KeyCode.Escape))
{
m_cursorIsLocked = false;
}
else if(Input.GetMouseButtonUp(0))
{
m_cursorIsLocked = true;
}

if (m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
else if (!m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}

Quaternion ClampRotationAroundXAxis(Quaternion q)
{
q.x /= q.w;
q.y /= q.w;
q.z /= q.w;
q.w = 1.0f;

float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan (q.x);

angleX = Mathf.Clamp (angleX, MinimumX, MaximumX);

q.x = Mathf.Tan (0.5f * Mathf.Deg2Rad * angleX);

return q;
}

}
}
@@ -20,7 +20,7 @@ MonoBehaviour:
m_ShowMode: 4
m_Title:
m_RootView: {fileID: 9}
m_MinSize: {x: 950, y: 542}
m_MinSize: {x: 950, y: 300}
m_MaxSize: {x: 10000, y: 10000}
--- !u!114 &2
MonoBehaviour:
@@ -36,9 +36,9 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 498
x: 551
y: 0
width: 780
width: 727
height: 582
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
@@ -70,7 +70,7 @@ MonoBehaviour:
m_MinSize: {x: 406, y: 221}
m_MaxSize: {x: 8006, y: 4021}
vertical: 0
controlID: 56
controlID: 31
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -87,15 +87,16 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 461
width: 728
height: 374
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 20}
m_Panes:
- {fileID: 20}
- {fileID: 17}
m_Selected: 0
m_LastSelected: 0
m_LastSelected: 1
--- !u!114 &5
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -116,10 +117,10 @@ MonoBehaviour:
y: 582
width: 1278
height: 374
m_MinSize: {x: 434, y: 271}
m_MaxSize: {x: 14004, y: 10021}
m_MinSize: {x: 436, y: 271}
m_MaxSize: {x: 14006, y: 10021}
vertical: 0
controlID: 79
controlID: 103
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -140,10 +141,10 @@ MonoBehaviour:
y: 30
width: 1680
height: 956
m_MinSize: {x: 709, y: 492}
m_MaxSize: {x: 18004, y: 14042}
m_MinSize: {x: 713, y: 492}
m_MaxSize: {x: 18008, y: 14042}
vertical: 0
controlID: 54
controlID: 29
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -184,20 +185,19 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 461
x: 728
y: 0
width: 817
width: 550
height: 374
m_MinSize: {x: 234, y: 271}
m_MaxSize: {x: 10004, y: 10021}
m_ActualView: {fileID: 18}
m_Panes:
- {fileID: 18}
- {fileID: 17}
- {fileID: 23}
- {fileID: 15}
m_Selected: 0
m_LastSelected: 2
m_LastSelected: 1
--- !u!114 &9
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -282,10 +282,10 @@ MonoBehaviour:
y: 0
width: 1278
height: 956
m_MinSize: {x: 434, y: 492}
m_MaxSize: {x: 14004, y: 14042}
m_MinSize: {x: 436, y: 492}
m_MaxSize: {x: 14006, y: 14042}
vertical: 1
controlID: 55
controlID: 30
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -302,7 +302,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 498
width: 551
height: 582
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
@@ -423,23 +423,23 @@ MonoBehaviour:
m_DepthBufferBits: 0
m_Pos:
serializedVersion: 2
x: 4
y: 94
width: 387
height: 406
x: 0
y: 93
width: 549
height: 561
m_PersistentViewDataDictionary: {fileID: 0}
m_ViewTransforms:
m_KeySerializationHelper:
- {fileID: 1107029514362718038, guid: e6d971ae10ef44efca0f887962f334d9, type: 2}
m_ValueSerializationHelper:
- e00: 1
- e00: 0.6242921
e01: 0
e02: 0
e03: 0
e03: -63.677765
e10: 0
e11: 1
e11: 0.6242921
e12: 0
e13: 0
e13: 282.8887
e20: 0
e21: 0
e22: 1
@@ -483,10 +483,10 @@ MonoBehaviour:
m_DepthBufferBits: 0
m_Pos:
serializedVersion: 2
x: 463
y: 672
width: 813
height: 356
x: 0
y: 675
width: 726
height: 353
m_PersistentViewDataDictionary: {fileID: 0}
m_AnimEditor: {fileID: 0}
m_Locked: 0
@@ -512,9 +512,9 @@ MonoBehaviour:
m_DepthBufferBits: 0
m_Pos:
serializedVersion: 2
x: 463
x: 730
y: 675
width: 813
width: 546
height: 353
m_PersistentViewDataDictionary: {fileID: 0}
m_SearchFilter:
@@ -529,7 +529,7 @@ MonoBehaviour:
m_ShowAllHits: 0
m_SearchArea: 0
m_Folders:
- Assets/Scripts/Character
- Assets/Animations
m_ViewMode: 0
m_StartGridSize: 64
m_LastFolders: []
@@ -540,7 +540,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: d22f0000
m_LastClickedID: 12242
m_ExpandedIDs: 00000000de270000e8270000f4270000fe27000000280000062800001a28000028280000342800003c2800006a28000070280000b8280000be280000c0280000d8280000ea2800000e29000076290000922900005a2b00005c2b00005e2b0000602b0000622b0000642b0000662b0000682b00006a2b00006c2b00006e2b0000702b0000722b0000742b0000762b0000782b00007a2b00007c2b00007e2b0000802b0000822b0000842b0000862b0000882b00008a2b00008c2b00008e2b0000902b0000922b0000942b0000
m_ExpandedIDs: 00000000d8270000e2270000fa27000000280000222800002e28000036280000642800006a28000072280000b2280000b8280000ba280000d2280000e428000008290000702900008c2900008e290000542b0000562b0000582b00005a2b00005c2b00005e2b0000602b0000622b0000642b0000662b0000682b00006a2b00006c2b00006e2b0000702b0000722b0000742b0000762b0000782b00007a2b00007c2b00007e2b0000802b0000822b0000842b0000862b0000882b00008a2b00008c2b00008e2b0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -565,24 +565,24 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_AssetTreeState:
scrollPos: {x: 0, y: 372.00378}
scrollPos: {x: 0, y: 270.00336}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000de270000e8270000f4270000fe27000000280000062800001a28000028280000342800003c2800006a28000070280000b8280000be280000c0280000d8280000ea2800000e29000076290000922900005a2b00005c2b00005e2b0000602b0000622b0000642b0000662b0000682b00006a2b00006c2b00006e2b0000702b0000722b0000742b0000762b0000782b00007a2b00007c2b00007e2b0000802b0000822b0000842b0000862b0000882b00008a2b00008c2b00008e2b0000902b0000922b0000942b0000
m_ExpandedIDs: 00000000d8270000e2270000fa27000000280000222800002e28000036280000642800006a28000072280000b2280000b8280000ba280000d2280000e428000008290000702900008c2900008e290000542b0000562b0000582b00005a2b00005c2b00005e2b0000602b0000622b0000642b0000662b0000682b00006a2b00006c2b00006e2b0000702b0000722b0000742b0000762b0000782b00007a2b00007c2b00007e2b0000802b0000822b0000842b0000862b0000882b00008a2b00008c2b00008e2b0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: Mei
m_OriginalName: Mei
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 1624
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 8}
m_SearchString:
@@ -650,7 +650,7 @@ MonoBehaviour:
width: 400
height: 935
m_PersistentViewDataDictionary: {fileID: 0}
m_ScrollPosition: {x: 0, y: 127.95508}
m_ScrollPosition: {x: 0, y: 0}
m_InspectorMode: 0
m_PreviewResizer:
m_CachedPref: 160
@@ -681,14 +681,14 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 675
width: 459
width: 726
height: 353
m_PersistentViewDataDictionary: {fileID: 0}
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 96fbffff
m_LastClickedID: -1130
m_ExpandedIDs: 98fbffff00000000
m_SelectedIDs: e4290000
m_LastClickedID: 10724
m_ExpandedIDs: 9efbffff00000000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -735,7 +735,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 93
width: 496
width: 549
height: 561
m_PersistentViewDataDictionary: {fileID: 0}
m_SceneLighting: 1
@@ -744,9 +744,9 @@ MonoBehaviour:
m_isRotationLocked: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 66.01171, y: 3.0894825, z: 57.702335}
m_Target: {x: 65.52531, y: 4.568513, z: 57.37473}
speed: 2
m_Value: {x: 66.01171, y: 3.0894825, z: 57.702335}
m_Value: {x: 65.52531, y: 4.568513, z: 57.37473}
m_RenderMode: 0
m_ValidateTrueMetals: 0
m_SceneViewState:
@@ -770,13 +770,13 @@ MonoBehaviour:
speed: 2
m_Value: 0
m_Rotation:
m_Target: {x: 0, y: -0.7071068, z: -0, w: 0.7071068}
m_Target: {x: -0.0069332463, y: 0.9820606, z: 0.03684457, w: 0.18479915}
speed: 2
m_Value: {x: -0, y: 0.7071068, z: 0, w: -0.7071068}
m_Value: {x: -0.006933246, y: 0.9820606, z: 0.03684457, w: 0.18479915}
m_Size:
m_Target: 6.648863
m_Target: 9.316265
speed: 2
m_Value: 6.648863
m_Value: 9.316265
m_Ortho:
m_Target: 0
speed: 2
@@ -810,9 +810,9 @@ MonoBehaviour:
m_DepthBufferBits: 32
m_Pos:
serializedVersion: 2
x: 2
y: 19
width: 776
x: 553
y: 93
width: 723
height: 561
m_PersistentViewDataDictionary: {fileID: 0}
m_MaximizeOnPlay: 0
@@ -823,8 +823,8 @@ MonoBehaviour:
m_ZoomArea:
m_HRangeLocked: 0
m_VRangeLocked: 0
m_HBaseRangeMin: -194
m_HBaseRangeMax: 194
m_HBaseRangeMin: -180.75
m_HBaseRangeMax: 180.75
m_VBaseRangeMin: -136
m_VBaseRangeMax: 136
m_HAllowExceedBaseRangeMin: 1
@@ -843,25 +843,25 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 17
width: 776
width: 723
height: 544
m_Scale: {x: 2, y: 2}
m_Translation: {x: 388, y: 272}
m_Translation: {x: 361.5, y: 272}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -194
x: -180.75
y: -136
width: 388
width: 361.5
height: 272
m_MinimalGUI: 1
m_defaultScale: 2
m_TargetTexture: {fileID: 0}
m_CurrentColorSpace: 0
m_LastWindowPixelSize: {x: 1552, y: 1122}
m_LastWindowPixelSize: {x: 1446, y: 1122}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000100000100
@@ -887,8 +887,8 @@ MonoBehaviour:
m_DepthBufferBits: 0
m_Pos:
serializedVersion: 2
x: 463
x: 730
y: 675
width: 813
width: 546
height: 353
m_PersistentViewDataDictionary: {fileID: 0}
BIN +756 Bytes (100%) Asato/Library/assetDatabase3
Binary file not shown.
BIN -12 Bytes (100%) Asato/Library/expandedItems
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.