新输入系统
This commit is contained in:
@@ -3,12 +3,309 @@
|
||||
"maps": [
|
||||
{
|
||||
"name": "Normal",
|
||||
"id": "e27ef1cb-bee4-466d-b123-4e3933d36713",
|
||||
"id": "df70fa95-8a34-4494-b137-73ab6b9c7d37",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Move",
|
||||
"type": "Value",
|
||||
"id": "351f2ccd-1f9f-44bf-9bec-d62ac5c5f408",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Look",
|
||||
"type": "Value",
|
||||
"id": "6b444451-8a00-4d00-a97e-f47457f736a8",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Zoom",
|
||||
"type": "Value",
|
||||
"id": "98493329-ff99-4095-8e99-7661388f993a",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Jump",
|
||||
"type": "Button",
|
||||
"id": "23ec065e-8aa4-4703-9210-e986bf59a239",
|
||||
"id": "f1ba0d36-48eb-4cd5-b651-1c94a6531f70",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Run",
|
||||
"type": "Button",
|
||||
"id": "641cd816-40e6-41b4-8c3d-04687c349290",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Op1",
|
||||
"type": "Button",
|
||||
"id": "a6038f56-bd74-4372-a689-9d124cb9dce4",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Op2",
|
||||
"type": "Button",
|
||||
"id": "eb447b1a-6476-4171-b4f6-5829e89b7bb1",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Use",
|
||||
"type": "Button",
|
||||
"id": "7372f7e2-b3d2-4e91-b8e6-2f0ccde6fc1f",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "SelectItem",
|
||||
"type": "Button",
|
||||
"id": "86ddb388-aafd-4894-ad60-548692875a44",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "SelectBait",
|
||||
"type": "Button",
|
||||
"id": "580ad571-1c6f-4a92-b7ef-5ad070f39c37",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "SelectFood",
|
||||
"type": "Button",
|
||||
"id": "ab97da75-1fc6-4078-8cd9-4f385acf6fb3",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "UseTorch",
|
||||
"type": "Button",
|
||||
"id": "b78e0e72-e07a-4eb1-bc15-5f5829362c66",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "UseTelescope",
|
||||
"type": "Button",
|
||||
"id": "337d2419-7c32-4034-8287-cb7ef2ddad9d",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "UseBrail",
|
||||
"type": "Button",
|
||||
"id": "c252c4a9-a2dc-4f0c-9643-e144c075ee48",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "AddBob",
|
||||
"type": "Button",
|
||||
"id": "9eb9dd0d-f826-42f4-aff7-c87e2e6f037e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "SubBob",
|
||||
"type": "Button",
|
||||
"id": "65665e2f-bf21-43f2-8b49-633cae84eb62",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "ToBag",
|
||||
"type": "Button",
|
||||
"id": "c2b64c66-782b-4ef6-a7cd-5010d18e501e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Help",
|
||||
"type": "Button",
|
||||
"id": "35448d22-d762-4d1f-b7a4-a86d0fa63115",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Chat",
|
||||
"type": "Button",
|
||||
"id": "1d9a2ea1-7814-461d-b1bc-b9fd69821b4f",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Info",
|
||||
"type": "Button",
|
||||
"id": "c4d3c929-e81c-4b78-bd98-50fc5b7ff997",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill",
|
||||
"type": "Button",
|
||||
"id": "24ce9048-15be-4799-83a8-ab1889f7bf60",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "OpenBag",
|
||||
"type": "Button",
|
||||
"id": "40fa0fcf-5ae1-48ae-b333-3fb10fad6cc2",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Keepnet",
|
||||
"type": "Button",
|
||||
"id": "5636ef35-4a13-42bc-a9e0-15dfd2a952bd",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Make",
|
||||
"type": "Button",
|
||||
"id": "67a15925-6997-4904-858b-879e440b6e3e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Map",
|
||||
"type": "Button",
|
||||
"id": "b84f3faa-ab54-448a-9362-c3950593ad77",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick1",
|
||||
"type": "Button",
|
||||
"id": "684b0dde-3f8f-4a88-9ecb-e0fb11de8f55",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick2",
|
||||
"type": "Button",
|
||||
"id": "318eb5e1-ef85-4d25-940c-207ca61a4f86",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick3",
|
||||
"type": "Button",
|
||||
"id": "97ed3871-2a0c-46bf-83bb-a4bad4d3d544",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick4",
|
||||
"type": "Button",
|
||||
"id": "a7b19131-f9dd-4f2a-b617-526856f6ae34",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick5",
|
||||
"type": "Button",
|
||||
"id": "41ac843b-c1a5-41fd-9b84-3c36bd6939e7",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick6",
|
||||
"type": "Button",
|
||||
"id": "a469cd36-0dca-4f9a-91c2-29c8e854d92c",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick7",
|
||||
"type": "Button",
|
||||
"id": "cbd4a3df-9c62-4090-87f0-167491afceb2",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick8",
|
||||
"type": "Button",
|
||||
"id": "e187691f-4928-4792-a356-11c571df6e8b",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Quick9",
|
||||
"type": "Button",
|
||||
"id": "79fdff4c-7c25-4970-9379-71e1c73534b0",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
@@ -18,17 +315,656 @@
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "622e8738-80f9-4c47-bdfc-febb097cff74",
|
||||
"id": "978bfe49-cc26-4a3d-ab7b-7d7a29327403",
|
||||
"path": "<Gamepad>/leftStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Gamepad",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "WASD",
|
||||
"id": "00ca640b-d935-4593-8157-c05846ea39b3",
|
||||
"path": "Dpad",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "e2062cb9-1b15-46a2-838c-2f8d72a0bdd9",
|
||||
"path": "<Keyboard>/w",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "8180e8bd-4097-4f4e-ab88-4523101a6ce9",
|
||||
"path": "<Keyboard>/upArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "320bffee-a40b-4347-ac70-c210eb8bc73a",
|
||||
"path": "<Keyboard>/s",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "1c5327b5-f71c-4f60-99c7-4e737386f1d1",
|
||||
"path": "<Keyboard>/downArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "d2581a9b-1d11-4566-b27d-b92aff5fabbc",
|
||||
"path": "<Keyboard>/a",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "2e46982e-44cc-431b-9f0b-c11910bf467a",
|
||||
"path": "<Keyboard>/leftArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "fcfe95b8-67b9-4526-84b5-5d0bc98d6400",
|
||||
"path": "<Keyboard>/d",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "77bff152-3580-4b21-b6de-dcd0c7e41164",
|
||||
"path": "<Keyboard>/rightArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "1635d3fe-58b6-4ba9-a4e2-f4b964f6b5c8",
|
||||
"path": "<XRController>/{Primary2DAxis}",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "XR",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "3ea4d645-4504-4529-b061-ab81934c3752",
|
||||
"path": "<Joystick>/stick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Joystick",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "c1f7a91b-d0fd-4a62-997e-7fb9b69bf235",
|
||||
"path": "<Gamepad>/rightStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Gamepad",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "8c8e490b-c610-4785-884f-f04217b23ca4",
|
||||
"path": "<Pointer>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse;Touch",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "3e5f5442-8668-4b27-a940-df99bad7e831",
|
||||
"path": "<Joystick>/{Hatswitch}",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Joystick",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "f2e9ba44-c423-42a7-ad56-f20975884794",
|
||||
"path": "<Keyboard>/leftShift",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Run",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "8cbb2f4b-a784-49cc-8d5e-c010b8c7f4e6",
|
||||
"path": "<Gamepad>/leftStickPress",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Run",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d8bf24bf-3f2f-4160-a97c-38ec1eb520ba",
|
||||
"path": "<XRController>/trigger",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "XR",
|
||||
"action": "Run",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "eb40bb66-4559-4dfa-9a2f-820438abb426",
|
||||
"path": "<Keyboard>/space",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "daba33a1-ad0c-4742-a909-43ad1cdfbeb6",
|
||||
"path": "<Gamepad>/buttonSouth",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "603f3daf-40bd-4854-8724-93e8017f59e3",
|
||||
"path": "<XRController>/secondaryButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "XR",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "13e7338f-4b65-4fe1-be3e-9e343214372a",
|
||||
"path": "<Mouse>/scroll",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Zoom",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "dc53c96d-ef5b-44af-ab2f-ec42f8e2e045",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Op1",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "35e599f2-e8a1-416e-bca5-f3a2137421d1",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Op2",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "01d704a4-4abb-4832-a338-6ecc59ac4c75",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Use",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "211b10df-e7a6-4128-a2a9-f8d3817914e4",
|
||||
"path": "<Keyboard>/b",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "SelectBait",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d5771e70-0672-4b6b-a48f-206cc5276812",
|
||||
"path": "<Keyboard>/t",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "SelectFood",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "85c51334-cad2-42b8-9bc0-9fa9bc0f9643",
|
||||
"path": "<Keyboard>/u",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "SelectItem",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "cea943ec-a234-44a2-8993-9da71b3ae18b",
|
||||
"path": "<Keyboard>/f",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "UseTorch",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "986650f5-2cf5-4141-95cc-6e68292d361a",
|
||||
"path": "<Keyboard>/z",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "UseTelescope",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "980d5d3e-d16c-4341-9ccd-013cca712b8a",
|
||||
"path": "<Keyboard>/space",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Jump",
|
||||
"action": "UseBrail",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ab09d705-53b7-4355-bca9-bc12a07ba5e6",
|
||||
"path": "<Keyboard>/equals",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "AddBob",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "23229eb8-1408-476c-ab39-a85cec86d2fa",
|
||||
"path": "<Keyboard>/minus",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "SubBob",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "bb2cdeeb-8818-4958-982c-144f48b52c2e",
|
||||
"path": "<Keyboard>/backspace",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "ToBag",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "9291baa5-42b7-41fb-91a9-a3f38b86d5e6",
|
||||
"path": "<Keyboard>/f1",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Help",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "815dc5ee-4737-4312-98c5-01670023c90b",
|
||||
"path": "<Keyboard>/q",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Chat",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ed0962d8-3fac-4742-acb1-a33c20ad4aa1",
|
||||
"path": "<Keyboard>/v",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Info",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0fa9b73e-f638-40ae-b9dd-7962a657900c",
|
||||
"path": "<Keyboard>/o",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "5a3a07bf-8da8-411a-a74f-88af99c6078b",
|
||||
"path": "<Keyboard>/i",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "OpenBag",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "9835cfe8-92fc-486e-9090-72133f850c1f",
|
||||
"path": "<Keyboard>/c",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Keepnet",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "4b8b8d1b-1920-4bfd-95f8-654e70fc9679",
|
||||
"path": "<Keyboard>/n",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Make",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "db12b135-f475-4d72-ab9f-a7bdcc9536ec",
|
||||
"path": "<Keyboard>/m",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Map",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "aa41d4be-4554-49ff-8ce9-e7b7391a4a0a",
|
||||
"path": "<Keyboard>/1",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick1",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ec90a04d-0c9f-4573-9585-e0684561af73",
|
||||
"path": "<Keyboard>/2",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick2",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "6e24d903-2893-465f-8a15-99ff269fb90a",
|
||||
"path": "<Keyboard>/3",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick3",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "b43a8a8d-396f-45d5-b7c0-49906d3959bf",
|
||||
"path": "<Keyboard>/4",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick4",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "9939c37d-0dd5-4ba5-8d15-687a25cf83d8",
|
||||
"path": "<Keyboard>/5",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick5",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "df0f7d01-b6a5-4a06-b145-4ac9521caa47",
|
||||
"path": "<Keyboard>/6",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick6",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d1f3bf38-81dd-40e5-8479-70318ec1049b",
|
||||
"path": "<Keyboard>/7",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick7",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "f9789cc4-2c44-4dfe-b7cd-e583d14d75cc",
|
||||
"path": "<Keyboard>/8",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick8",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "6857da81-80ac-4d7d-ac72-c656cca1209f",
|
||||
"path": "<Keyboard>/9",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Quick9",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UI",
|
||||
"id": "1e134a50-caf1-48ef-a011-2fabe2c0d049",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Roll",
|
||||
"type": "Button",
|
||||
"id": "379cc72d-f733-45da-b173-b881ab8ab0ed",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "0e66040a-5980-401a-85c3-b2ef2cc13664",
|
||||
"path": "",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Roll",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": []
|
||||
"controlSchemes": [
|
||||
{
|
||||
"name": "Keyboard&Mouse",
|
||||
"bindingGroup": "Keyboard&Mouse",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Keyboard>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
},
|
||||
{
|
||||
"devicePath": "<Mouse>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Gamepad",
|
||||
"bindingGroup": "Gamepad",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Gamepad>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Touch",
|
||||
"bindingGroup": "Touch",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Touchscreen>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Joystick",
|
||||
"bindingGroup": "Joystick",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Joystick>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "XR",
|
||||
"bindingGroup": "XR",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<XRController>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0e3cb5a99f3d324ea14bfe64485b2e4
|
||||
guid: 8a314d59348c97b4e96e6eb9b09285a6
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -11,4 +11,4 @@ ScriptedImporter:
|
||||
generateWrapperCode: 1
|
||||
wrapperCodePath: Assets/Scripts/Fishing/PlayerInputControl.cs
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
wrapperCodeNamespace: NBF
|
||||
|
||||
@@ -4153,8 +4153,8 @@ MonoBehaviour:
|
||||
m_StickToGroundForce: 10
|
||||
m_GravityMultiplier: 2
|
||||
m_MouseLook:
|
||||
XSensitivity: 2
|
||||
YSensitivity: 2
|
||||
XSensitivity: 1
|
||||
YSensitivity: 1
|
||||
clampVerticalRotation: 1
|
||||
MinimumX: -40
|
||||
MaximumX: 70
|
||||
@@ -4371,7 +4371,10 @@ MonoBehaviour:
|
||||
configId: 0
|
||||
position: {x: 0, y: 0, z: 0}
|
||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||
currentReelingSpeed: 0
|
||||
isHandOnHandle: 0
|
||||
lineLength: 0
|
||||
reelSpeed: 0
|
||||
state: 0
|
||||
lineCutTimer: 0
|
||||
selectorRodSetting: 0
|
||||
@@ -4382,6 +4385,7 @@ MonoBehaviour:
|
||||
PlayerAnimatorCtrl: {fileID: 0}
|
||||
Gears: {fileID: 0}
|
||||
LineRenderer: {fileID: 0}
|
||||
LureTrajectorySimulator: {fileID: 0}
|
||||
--- !u!114 &8072573713298176091
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,129 +1,452 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
// using Rewired;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InputManager : MonoBehaviour
|
||||
namespace NBF
|
||||
{
|
||||
public struct POINT
|
||||
public class InputManager : MonoBehaviour
|
||||
{
|
||||
public int X;
|
||||
public static bool IsOp1;
|
||||
public static bool IsOp2;
|
||||
|
||||
public int Y;
|
||||
}
|
||||
public static bool IsRunning;
|
||||
|
||||
public static event Action<bool> OnOp1Action;
|
||||
public static event Action<bool> OnOp2Action;
|
||||
public static event Action<bool> OnUseAction;
|
||||
public static event Action<bool> OnSelectItemAction;
|
||||
public static event Action<bool> OnSelectBaitAction;
|
||||
public static event Action<bool> OnSelectFoodAction;
|
||||
|
||||
/// <summary>
|
||||
/// 快速选择数值
|
||||
/// </summary>
|
||||
public static event Action<int> OnQuickIndexAction;
|
||||
|
||||
/// <summary>
|
||||
/// 使用手电筒
|
||||
/// </summary>
|
||||
public static event Action<bool> OnUseTorchAction;
|
||||
|
||||
/// <summary>
|
||||
/// 使用抄网
|
||||
/// </summary>
|
||||
public static event Action<bool> OnUseBrailAction;
|
||||
|
||||
/// <summary>
|
||||
/// 使用望远镜
|
||||
/// </summary>
|
||||
public static event Action<bool> OnUseTelescopeAction;
|
||||
|
||||
/// <summary>
|
||||
/// 添加浮漂
|
||||
/// </summary>
|
||||
public static event Action<bool> OnAddBobAction;
|
||||
|
||||
/// <summary>
|
||||
/// 减少浮漂
|
||||
/// </summary>
|
||||
public static event Action<bool> OnSubBobAction;
|
||||
|
||||
/// <summary>
|
||||
/// 返回背包
|
||||
/// </summary>
|
||||
public static event Action<bool> OnToBagAction;
|
||||
|
||||
|
||||
// [Tooltip("Rewired Input Manager's player used for handling player's input")]
|
||||
// private Player player;
|
||||
/// <summary>
|
||||
/// 帮助
|
||||
/// </summary>
|
||||
public static event Action<bool> OnHelpAction;
|
||||
|
||||
public bool IgnoreAllInput = false;
|
||||
/// <summary>
|
||||
/// 聊天
|
||||
/// </summary>
|
||||
public static event Action<bool> OnChatAction;
|
||||
|
||||
/// <summary>
|
||||
/// 物品信息
|
||||
/// </summary>
|
||||
public static event Action<bool> OnInfoAction;
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
public static event Action<bool> OnSkillAction;
|
||||
|
||||
/// <summary>
|
||||
/// 打开背包
|
||||
/// </summary>
|
||||
public static event Action<bool> OnOpenBagAction;
|
||||
|
||||
/// <summary>
|
||||
/// 打开鱼护
|
||||
/// </summary>
|
||||
public static event Action<bool> OnKeepnetAction;
|
||||
|
||||
/// <summary>
|
||||
/// 打开制造
|
||||
/// </summary>
|
||||
public static event Action<bool> OnMakeAction;
|
||||
|
||||
/// <summary>
|
||||
/// 打开地图
|
||||
/// </summary>
|
||||
public static event Action<bool> OnMapAction;
|
||||
|
||||
|
||||
public static bool IsMouseLeft;
|
||||
public static bool IsMouseRight;
|
||||
public static PlayerInputControl PlayerInputControl { get; private set; }
|
||||
|
||||
|
||||
public static bool isShowSlot0;
|
||||
|
||||
public static bool isShowSlot1;
|
||||
|
||||
public static bool isShowSlot2;
|
||||
|
||||
public static bool isShowSlot3;
|
||||
|
||||
public static bool isShowSlot4;
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool SetCursorPos(int X, int Y);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool GetCursorPos(out POINT lpPoint);
|
||||
|
||||
|
||||
private PlayerInputControl _playerInputControl;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_playerInputControl = new PlayerInputControl();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (IgnoreAllInput)
|
||||
public static Vector2 GetMovementInput()
|
||||
{
|
||||
return;
|
||||
return PlayerInputControl.Normal.Move?.ReadValue<Vector2>() ?? Vector2.zero;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
public static Vector2 GetLookInput()
|
||||
{
|
||||
IsMouseLeft = true;
|
||||
return PlayerInputControl.Normal.Look?.ReadValue<Vector2>() ?? Vector2.zero;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
private void Start()
|
||||
{
|
||||
IsMouseLeft = false;
|
||||
PlayerInputControl = new PlayerInputControl();
|
||||
PlayerInputControl.Enable();
|
||||
PlayerInputControl.Normal.Enable();
|
||||
AddEvent();
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
private void OnDestroy()
|
||||
{
|
||||
IsMouseRight = true;
|
||||
RemoveEvent();
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(1))
|
||||
private void AddEvent()
|
||||
{
|
||||
IsMouseRight = false;
|
||||
PlayerInputControl.Normal.Run.performed += OnRun;
|
||||
PlayerInputControl.Normal.Run.canceled += OnRun;
|
||||
PlayerInputControl.Normal.Op1.performed += OnOp1;
|
||||
PlayerInputControl.Normal.Op1.canceled += OnOp1;
|
||||
PlayerInputControl.Normal.Op2.performed += OnOp2;
|
||||
PlayerInputControl.Normal.Op2.canceled += OnOp2;
|
||||
PlayerInputControl.Normal.Use.performed += OnUse;
|
||||
PlayerInputControl.Normal.Use.canceled += OnUse;
|
||||
|
||||
PlayerInputControl.Normal.SelectItem.performed += OnSelectItem;
|
||||
PlayerInputControl.Normal.SelectItem.canceled += OnSelectItem;
|
||||
|
||||
PlayerInputControl.Normal.SelectFood.performed += OnSelectFood;
|
||||
PlayerInputControl.Normal.SelectFood.canceled += OnSelectFood;
|
||||
|
||||
PlayerInputControl.Normal.SelectBait.performed += OnSelectBait;
|
||||
PlayerInputControl.Normal.SelectBait.canceled += OnSelectBait;
|
||||
|
||||
PlayerInputControl.Normal.UseTorch.performed += OnUseTorch;
|
||||
PlayerInputControl.Normal.UseTorch.canceled += OnUseTorch;
|
||||
|
||||
PlayerInputControl.Normal.UseTelescope.performed += OnUseTelescope;
|
||||
PlayerInputControl.Normal.UseTelescope.canceled += OnUseTelescope;
|
||||
|
||||
PlayerInputControl.Normal.UseBrail.performed += OnUseBrail;
|
||||
PlayerInputControl.Normal.UseBrail.canceled += OnUseBrail;
|
||||
|
||||
PlayerInputControl.Normal.AddBob.performed += OnAddBob;
|
||||
PlayerInputControl.Normal.AddBob.canceled += OnAddBob;
|
||||
|
||||
PlayerInputControl.Normal.SubBob.performed += OnSubBob;
|
||||
PlayerInputControl.Normal.SubBob.canceled += OnSubBob;
|
||||
|
||||
PlayerInputControl.Normal.ToBag.performed += OnToBag;
|
||||
PlayerInputControl.Normal.ToBag.canceled += OnToBag;
|
||||
|
||||
PlayerInputControl.Normal.Help.performed += OnHelp;
|
||||
PlayerInputControl.Normal.Help.canceled += OnHelp;
|
||||
|
||||
PlayerInputControl.Normal.Chat.performed += OnChat;
|
||||
PlayerInputControl.Normal.Chat.canceled += OnChat;
|
||||
|
||||
PlayerInputControl.Normal.Info.performed += OnInfo;
|
||||
PlayerInputControl.Normal.Info.canceled += OnInfo;
|
||||
|
||||
PlayerInputControl.Normal.Skill.performed += OnSkill;
|
||||
PlayerInputControl.Normal.Skill.canceled += OnSkill;
|
||||
|
||||
PlayerInputControl.Normal.OpenBag.performed += OnOpenBag;
|
||||
PlayerInputControl.Normal.OpenBag.canceled += OnOpenBag;
|
||||
|
||||
PlayerInputControl.Normal.Keepnet.performed += OnKeepnet;
|
||||
PlayerInputControl.Normal.Keepnet.canceled += OnKeepnet;
|
||||
|
||||
PlayerInputControl.Normal.Make.performed += OnMake;
|
||||
PlayerInputControl.Normal.Make.canceled += OnMake;
|
||||
|
||||
PlayerInputControl.Normal.Map.performed += OnMap;
|
||||
PlayerInputControl.Normal.Map.canceled += OnMap;
|
||||
|
||||
PlayerInputControl.Normal.Quick1.performed += OnQuick1;
|
||||
PlayerInputControl.Normal.Quick2.performed += OnQuick2;
|
||||
PlayerInputControl.Normal.Quick3.performed += OnQuick3;
|
||||
PlayerInputControl.Normal.Quick4.performed += OnQuick4;
|
||||
PlayerInputControl.Normal.Quick5.performed += OnQuick5;
|
||||
PlayerInputControl.Normal.Quick6.performed += OnQuick6;
|
||||
PlayerInputControl.Normal.Quick7.performed += OnQuick7;
|
||||
PlayerInputControl.Normal.Quick8.performed += OnQuick8;
|
||||
PlayerInputControl.Normal.Quick9.performed += OnQuick9;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha0))
|
||||
private void RemoveEvent()
|
||||
{
|
||||
isShowSlot0 = true;
|
||||
Debug.LogError("showSlot0======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot0 = false;
|
||||
PlayerInputControl.Normal.Run.performed -= OnRun;
|
||||
PlayerInputControl.Normal.Run.canceled -= OnRun;
|
||||
PlayerInputControl.Normal.Op1.performed -= OnOp1;
|
||||
PlayerInputControl.Normal.Op1.canceled -= OnOp1;
|
||||
PlayerInputControl.Normal.Op2.performed -= OnOp2;
|
||||
PlayerInputControl.Normal.Op2.canceled -= OnOp2;
|
||||
PlayerInputControl.Normal.Use.performed -= OnUse;
|
||||
PlayerInputControl.Normal.Use.canceled -= OnUse;
|
||||
|
||||
PlayerInputControl.Normal.SelectItem.performed -= OnSelectItem;
|
||||
PlayerInputControl.Normal.SelectItem.canceled -= OnSelectItem;
|
||||
|
||||
PlayerInputControl.Normal.SelectFood.performed -= OnSelectFood;
|
||||
PlayerInputControl.Normal.SelectFood.canceled -= OnSelectFood;
|
||||
|
||||
PlayerInputControl.Normal.SelectBait.performed -= OnSelectBait;
|
||||
PlayerInputControl.Normal.SelectBait.canceled -= OnSelectBait;
|
||||
|
||||
PlayerInputControl.Normal.UseTorch.performed -= OnUseTorch;
|
||||
PlayerInputControl.Normal.UseTorch.canceled -= OnUseTorch;
|
||||
|
||||
PlayerInputControl.Normal.UseTelescope.performed -= OnUseTelescope;
|
||||
PlayerInputControl.Normal.UseTelescope.canceled -= OnUseTelescope;
|
||||
|
||||
PlayerInputControl.Normal.UseBrail.performed -= OnUseBrail;
|
||||
PlayerInputControl.Normal.UseBrail.canceled -= OnUseBrail;
|
||||
|
||||
PlayerInputControl.Normal.AddBob.performed -= OnAddBob;
|
||||
PlayerInputControl.Normal.AddBob.canceled -= OnAddBob;
|
||||
|
||||
PlayerInputControl.Normal.SubBob.performed -= OnSubBob;
|
||||
PlayerInputControl.Normal.SubBob.canceled -= OnSubBob;
|
||||
|
||||
PlayerInputControl.Normal.ToBag.performed -= OnToBag;
|
||||
PlayerInputControl.Normal.ToBag.canceled -= OnToBag;
|
||||
|
||||
PlayerInputControl.Normal.Help.performed -= OnHelp;
|
||||
PlayerInputControl.Normal.Help.canceled -= OnHelp;
|
||||
|
||||
PlayerInputControl.Normal.Chat.performed -= OnChat;
|
||||
PlayerInputControl.Normal.Chat.canceled -= OnChat;
|
||||
|
||||
PlayerInputControl.Normal.Info.performed -= OnInfo;
|
||||
PlayerInputControl.Normal.Info.canceled -= OnInfo;
|
||||
|
||||
PlayerInputControl.Normal.Skill.performed -= OnSkill;
|
||||
PlayerInputControl.Normal.Skill.canceled -= OnSkill;
|
||||
|
||||
PlayerInputControl.Normal.OpenBag.performed -= OnOpenBag;
|
||||
PlayerInputControl.Normal.OpenBag.canceled -= OnOpenBag;
|
||||
|
||||
PlayerInputControl.Normal.Keepnet.performed -= OnKeepnet;
|
||||
PlayerInputControl.Normal.Keepnet.canceled -= OnKeepnet;
|
||||
|
||||
PlayerInputControl.Normal.Make.performed -= OnMake;
|
||||
PlayerInputControl.Normal.Make.canceled -= OnMake;
|
||||
|
||||
PlayerInputControl.Normal.Map.performed -= OnMap;
|
||||
PlayerInputControl.Normal.Map.canceled -= OnMap;
|
||||
|
||||
PlayerInputControl.Normal.Quick1.performed -= OnQuick1;
|
||||
PlayerInputControl.Normal.Quick2.performed -= OnQuick2;
|
||||
PlayerInputControl.Normal.Quick3.performed -= OnQuick3;
|
||||
PlayerInputControl.Normal.Quick4.performed -= OnQuick4;
|
||||
PlayerInputControl.Normal.Quick5.performed -= OnQuick5;
|
||||
PlayerInputControl.Normal.Quick6.performed -= OnQuick6;
|
||||
PlayerInputControl.Normal.Quick7.performed -= OnQuick7;
|
||||
PlayerInputControl.Normal.Quick8.performed -= OnQuick8;
|
||||
PlayerInputControl.Normal.Quick9.performed -= OnQuick9;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||||
private void OnRun(InputAction.CallbackContext context)
|
||||
{
|
||||
isShowSlot1 = true;
|
||||
Debug.LogError("showSlot1======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot1 = false;
|
||||
IsRunning = context.performed;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha2))
|
||||
private void OnOp1(InputAction.CallbackContext context)
|
||||
{
|
||||
isShowSlot2 = true;
|
||||
Debug.LogError("showSlot2======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot2 = false;
|
||||
IsOp1 = context.performed;
|
||||
Debug.Log($"IsOp1={IsOp1}");
|
||||
OnOp1Action?.Invoke(IsOp1);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
private void OnOp2(InputAction.CallbackContext context)
|
||||
{
|
||||
isShowSlot3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot3 = false;
|
||||
IsOp2 = context.performed;
|
||||
Debug.Log($"OnOp2={IsOp2}");
|
||||
OnOp2Action?.Invoke(IsOp2);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha4))
|
||||
private void OnUse(InputAction.CallbackContext context)
|
||||
{
|
||||
isShowSlot4 = true;
|
||||
OnUseAction?.Invoke(context.performed);
|
||||
}
|
||||
else
|
||||
|
||||
private void OnSelectItem(InputAction.CallbackContext context)
|
||||
{
|
||||
isShowSlot4 = false;
|
||||
OnSelectItemAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnSelectFood(InputAction.CallbackContext context)
|
||||
{
|
||||
OnSelectFoodAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnSelectBait(InputAction.CallbackContext context)
|
||||
{
|
||||
OnSelectBaitAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnUseTorch(InputAction.CallbackContext context)
|
||||
{
|
||||
OnUseTorchAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnUseTelescope(InputAction.CallbackContext context)
|
||||
{
|
||||
OnUseTelescopeAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnUseBrail(InputAction.CallbackContext context)
|
||||
{
|
||||
OnUseBrailAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnAddBob(InputAction.CallbackContext context)
|
||||
{
|
||||
OnSubBobAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnSubBob(InputAction.CallbackContext context)
|
||||
{
|
||||
OnSubBobAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnToBag(InputAction.CallbackContext context)
|
||||
{
|
||||
OnToBagAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnHelp(InputAction.CallbackContext context)
|
||||
{
|
||||
OnHelpAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnChat(InputAction.CallbackContext context)
|
||||
{
|
||||
OnChatAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnInfo(InputAction.CallbackContext context)
|
||||
{
|
||||
OnInfoAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnSkill(InputAction.CallbackContext context)
|
||||
{
|
||||
OnSkillAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnOpenBag(InputAction.CallbackContext context)
|
||||
{
|
||||
OnOpenBagAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnKeepnet(InputAction.CallbackContext context)
|
||||
{
|
||||
OnKeepnetAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnMake(InputAction.CallbackContext context)
|
||||
{
|
||||
OnMakeAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnMap(InputAction.CallbackContext context)
|
||||
{
|
||||
OnMapAction?.Invoke(context.performed);
|
||||
}
|
||||
|
||||
private void OnQuick1(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick2(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(2);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick3(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(3);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick4(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(4);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick5(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(5);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick6(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(6);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick7(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(7);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick8(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuick9(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnQuickIndexAction?.Invoke(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace NBF
|
||||
player.currentGear = new FPlayerGearData();
|
||||
var gear = player.currentGear;
|
||||
|
||||
if (slot == 0)
|
||||
if (slot == 1)
|
||||
{
|
||||
player.lineLength = 3.6f;
|
||||
gear.Type = GearType.Pole;
|
||||
@@ -88,7 +88,7 @@ namespace NBF
|
||||
};
|
||||
gear.reel = null;
|
||||
}
|
||||
else if (slot == 1)
|
||||
else if (slot == 2)
|
||||
{
|
||||
player.lineLength = 0.4f;
|
||||
gear.Type = GearType.SpinningFloat;
|
||||
@@ -128,7 +128,7 @@ namespace NBF
|
||||
configId = 800001
|
||||
};
|
||||
}
|
||||
else if (slot == 2)
|
||||
else if (slot == 3)
|
||||
{
|
||||
player.lineLength = 0.4f;
|
||||
gear.Type = GearType.Spinning;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace NBF
|
||||
return States.Player.Idle;
|
||||
}
|
||||
|
||||
if (InputManager.IsMouseLeft)
|
||||
if (InputManager.IsOp1)
|
||||
{
|
||||
if (_owner.PlayerAnimatorCtrl.ThrowMode == ThrowModeEnum.Float)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
if (InputManager.IsMouseRight)
|
||||
if (InputManager.IsOp2)
|
||||
{
|
||||
if (_owner.PlayerAnimatorCtrl.ThrowMode == ThrowModeEnum.Spin)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace NBF
|
||||
if (_owner.Gears.Rod)
|
||||
{
|
||||
//如果准备好了杆子,则可进入抛竿
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
if (InputManager.IsOp1)
|
||||
{
|
||||
return States.Player.WaitThrow;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace NBF
|
||||
ChargedProgress = 1;
|
||||
}
|
||||
|
||||
if (!InputManager.IsMouseLeft)
|
||||
if (!InputManager.IsOp1)
|
||||
{
|
||||
Stage = Phase.Confirm;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ namespace NBF
|
||||
Timer.Once(1f, this, EnableFirstPersonController);
|
||||
|
||||
App.Inst.SetMouseCurrsor(false);
|
||||
|
||||
InputManager.OnQuickIndexAction += OnQuickIndexAction;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
InputManager.OnQuickIndexAction -= OnQuickIndexAction;
|
||||
}
|
||||
|
||||
private void EnableFirstPersonController()
|
||||
@@ -41,14 +48,24 @@ namespace NBF
|
||||
firstPersonController.enabled = true;
|
||||
}
|
||||
|
||||
private void OnQuickIndexAction(int index)
|
||||
{
|
||||
nextShowSlotIndex = index;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// firstPersonController.horizontal = InputManager.movementAxis.x;
|
||||
// firstPersonController.vertical = InputManager.movementAxis.y;
|
||||
//
|
||||
// firstPersonController.isJumping = InputManager.isJumping;
|
||||
// firstPersonController.isRuning = InputManager.isRunning;
|
||||
var movementAxis = InputManager.GetMovementInput();
|
||||
if (movementAxis != Vector2.zero)
|
||||
{
|
||||
// Debug
|
||||
}
|
||||
|
||||
firstPersonController.horizontal = movementAxis.x;
|
||||
firstPersonController.vertical = movementAxis.y;
|
||||
|
||||
// firstPersonController.isJumping = InputManager.IsJumping;
|
||||
firstPersonController.isRuning = InputManager.IsRunning;
|
||||
|
||||
// firstPersonController.m_MouseLook.ControllerHandMode = GameManager.Instance._playerData
|
||||
// .Player[GameManager.Instance._playerData.currentPlayerProfileIndex].controllerSetup;
|
||||
@@ -67,42 +84,10 @@ namespace NBF
|
||||
firstPersonController.m_RunSpeed = runningSpeed;
|
||||
}
|
||||
|
||||
// firstPersonController.m_MouseLook.XSensitivity =
|
||||
// GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex]
|
||||
// .mouseSensitivity * GetPlayerHandPower();
|
||||
// firstPersonController.m_MouseLook.YSensitivity =
|
||||
// GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex]
|
||||
// .mouseSensitivity * GetPlayerHandPower();
|
||||
|
||||
|
||||
if (_player.CanChangeGear())
|
||||
{
|
||||
// if (InputManager.isShowSlot0)
|
||||
// {
|
||||
// nextShowSlotIndex = 0;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot1)
|
||||
// {
|
||||
// nextShowSlotIndex = 1;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot2)
|
||||
// {
|
||||
// nextShowSlotIndex = 2;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot3)
|
||||
// {
|
||||
// nextShowSlotIndex = 3;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot4)
|
||||
// {
|
||||
// nextShowSlotIndex = 4;
|
||||
// }
|
||||
|
||||
if (nextShowSlotIndex != -1)
|
||||
if (nextShowSlotIndex > 0)
|
||||
{
|
||||
Debug.LogError("切换钓组=========");
|
||||
var data = Fishing.Inst.Datasource;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,338 +3,336 @@ using UnityStandardAssets.Utility;
|
||||
|
||||
namespace UnityStandardAssets.Characters.FirstPerson
|
||||
{
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class FirstPersonController : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private bool m_IsWalking;
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class FirstPersonController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private bool m_IsWalking;
|
||||
|
||||
[SerializeField]
|
||||
public float m_WalkSpeed;
|
||||
[SerializeField] public float m_WalkSpeed;
|
||||
|
||||
[SerializeField]
|
||||
public float m_RunSpeed;
|
||||
[SerializeField] public float m_RunSpeed;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0f, 1f)]
|
||||
private float m_RunstepLenghten;
|
||||
[SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten;
|
||||
|
||||
[SerializeField]
|
||||
private float m_JumpSpeed;
|
||||
[SerializeField] private float m_JumpSpeed;
|
||||
|
||||
[SerializeField]
|
||||
private float m_StickToGroundForce;
|
||||
[SerializeField] private float m_StickToGroundForce;
|
||||
|
||||
[SerializeField]
|
||||
private float m_GravityMultiplier;
|
||||
[SerializeField] private float m_GravityMultiplier;
|
||||
|
||||
[SerializeField]
|
||||
public MouseLook m_MouseLook;
|
||||
[SerializeField] public MouseLook m_MouseLook;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_UseFovKick;
|
||||
[SerializeField] private bool m_UseFovKick;
|
||||
|
||||
[SerializeField]
|
||||
private FOVKick m_FovKick = new FOVKick();
|
||||
[SerializeField] private FOVKick m_FovKick = new FOVKick();
|
||||
|
||||
[SerializeField]
|
||||
private bool m_UseHeadBob;
|
||||
[SerializeField] private bool m_UseHeadBob;
|
||||
|
||||
[SerializeField]
|
||||
private CurveControlledBob m_HeadBob = new CurveControlledBob();
|
||||
[SerializeField] private CurveControlledBob m_HeadBob = new CurveControlledBob();
|
||||
|
||||
[SerializeField]
|
||||
private LerpControlledBob m_JumpBob = new LerpControlledBob();
|
||||
[SerializeField] private LerpControlledBob m_JumpBob = new LerpControlledBob();
|
||||
|
||||
[SerializeField]
|
||||
private float m_StepInterval;
|
||||
[SerializeField] private float m_StepInterval;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip[] m_FootstepSounds;
|
||||
[SerializeField] private AudioClip[] m_FootstepSounds;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip[] m_FootstepSoundsBridge;
|
||||
[SerializeField] private AudioClip[] m_FootstepSoundsBridge;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip[] m_FootstepSoundsStone;
|
||||
[SerializeField] private AudioClip[] m_FootstepSoundsStone;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip m_JumpSound;
|
||||
[SerializeField] private AudioClip m_JumpSound;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip m_LandSound;
|
||||
[SerializeField] private AudioClip m_LandSound;
|
||||
|
||||
private Camera m_Camera;
|
||||
private Camera m_Camera;
|
||||
|
||||
private bool m_Jump;
|
||||
private bool m_Jump;
|
||||
|
||||
public bool frezzeRotation;
|
||||
public bool frezzeRotation;
|
||||
|
||||
public bool frezzePosition;
|
||||
public bool frezzePosition;
|
||||
|
||||
public bool rotateMouseInFixedUpdate = true;
|
||||
public bool rotateMouseInFixedUpdate = true;
|
||||
|
||||
public Vector2 m_Input;
|
||||
public Vector2 m_Input;
|
||||
|
||||
public Vector3 m_MoveDir = Vector3.zero;
|
||||
public Vector3 m_MoveDir = Vector3.zero;
|
||||
|
||||
public CharacterController m_CharacterController;
|
||||
public CharacterController m_CharacterController;
|
||||
|
||||
private CollisionFlags m_CollisionFlags;
|
||||
private CollisionFlags m_CollisionFlags;
|
||||
|
||||
private bool m_PreviouslyGrounded;
|
||||
private bool m_PreviouslyGrounded;
|
||||
|
||||
private Vector3 m_OriginalCameraPosition;
|
||||
private Vector3 m_OriginalCameraPosition;
|
||||
|
||||
private float m_StepCycle;
|
||||
private float m_StepCycle;
|
||||
|
||||
private float m_NextStep;
|
||||
private float m_NextStep;
|
||||
|
||||
private bool m_Jumping;
|
||||
private bool m_Jumping;
|
||||
|
||||
private AudioSource m_AudioSource;
|
||||
private AudioSource m_AudioSource;
|
||||
|
||||
private string groundTypeTag = "";
|
||||
private string groundTypeTag = "";
|
||||
|
||||
public float horizontal;
|
||||
public float horizontal;
|
||||
|
||||
public float vertical;
|
||||
public float vertical;
|
||||
|
||||
public bool isJumping;
|
||||
public bool isJumping;
|
||||
|
||||
public bool isRuning;
|
||||
public bool isRuning;
|
||||
|
||||
public bool notMove;
|
||||
public bool notMove;
|
||||
|
||||
[HideInInspector]
|
||||
public Vector3 lastValidPosition = Vector3.zero;
|
||||
[HideInInspector] public Vector3 lastValidPosition = Vector3.zero;
|
||||
|
||||
public bool isWater;
|
||||
public bool isWater;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_CharacterController = GetComponent<CharacterController>();
|
||||
m_Camera = Camera.main;
|
||||
m_OriginalCameraPosition = m_Camera.transform.localPosition;
|
||||
m_FovKick.Setup(m_Camera);
|
||||
m_HeadBob.Setup(m_Camera, m_StepInterval);
|
||||
m_StepCycle = 0f;
|
||||
m_NextStep = m_StepCycle / 2f;
|
||||
m_Jumping = false;
|
||||
m_AudioSource = GetComponent<AudioSource>();
|
||||
m_MouseLook.Init(transform, m_Camera.transform);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
m_CharacterController = GetComponent<CharacterController>();
|
||||
m_Camera = Camera.main;
|
||||
m_OriginalCameraPosition = m_Camera.transform.localPosition;
|
||||
m_FovKick.Setup(m_Camera);
|
||||
m_HeadBob.Setup(m_Camera, m_StepInterval);
|
||||
m_StepCycle = 0f;
|
||||
m_NextStep = m_StepCycle / 2f;
|
||||
m_Jumping = false;
|
||||
m_AudioSource = GetComponent<AudioSource>();
|
||||
m_MouseLook.Init(transform, m_Camera.transform);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!frezzeRotation && !rotateMouseInFixedUpdate)
|
||||
{
|
||||
RotateView();
|
||||
}
|
||||
if (!m_Jump)
|
||||
{
|
||||
m_Jump = isJumping;
|
||||
}
|
||||
if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
|
||||
{
|
||||
StartCoroutine(m_JumpBob.DoBobCycle());
|
||||
PlayLandingSound();
|
||||
m_MoveDir.y = 0f;
|
||||
m_Jumping = false;
|
||||
}
|
||||
if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
|
||||
{
|
||||
m_MoveDir.y = 0f;
|
||||
}
|
||||
m_PreviouslyGrounded = m_CharacterController.isGrounded;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (!frezzeRotation && !rotateMouseInFixedUpdate)
|
||||
{
|
||||
RotateView();
|
||||
}
|
||||
|
||||
private void PlayLandingSound()
|
||||
{
|
||||
m_AudioSource.clip = m_LandSound;
|
||||
m_AudioSource.Play();
|
||||
m_NextStep = m_StepCycle + 0.5f;
|
||||
}
|
||||
if (!m_Jump)
|
||||
{
|
||||
m_Jump = isJumping;
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!frezzeRotation && rotateMouseInFixedUpdate)
|
||||
{
|
||||
RotateView();
|
||||
}
|
||||
if (frezzePosition)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GetInput(out var speed);
|
||||
Vector3 vector = transform.forward * m_Input.y + transform.right * m_Input.x;
|
||||
Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out var hitInfo, m_CharacterController.height / 2f, -1, QueryTriggerInteraction.Ignore);
|
||||
vector = Vector3.ProjectOnPlane(vector, hitInfo.normal).normalized;
|
||||
m_MoveDir.x = vector.x * speed;
|
||||
m_MoveDir.z = vector.z * speed;
|
||||
if (m_CharacterController.isGrounded)
|
||||
{
|
||||
m_MoveDir.y = 0f - m_StickToGroundForce;
|
||||
if (m_Jump && !isWater)
|
||||
{
|
||||
if ((bool)transform.parent && transform.parent.gameObject.layer == LayerMask.NameToLayer("Boat"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_MoveDir.y = m_JumpSpeed;
|
||||
PlayJumpSound();
|
||||
m_Jump = false;
|
||||
m_Jumping = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MoveDir += Physics.gravity * m_GravityMultiplier * Time.fixedDeltaTime;
|
||||
}
|
||||
if (!notMove)
|
||||
{
|
||||
m_CollisionFlags = m_CharacterController.Move(m_MoveDir * Time.fixedDeltaTime);
|
||||
}
|
||||
ProgressStepCycle(speed);
|
||||
UpdateCameraPosition(speed);
|
||||
m_MouseLook.UpdateCursorLock();
|
||||
}
|
||||
if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
|
||||
{
|
||||
StartCoroutine(m_JumpBob.DoBobCycle());
|
||||
PlayLandingSound();
|
||||
m_MoveDir.y = 0f;
|
||||
m_Jumping = false;
|
||||
}
|
||||
|
||||
private void PlayJumpSound()
|
||||
{
|
||||
m_AudioSource.clip = m_JumpSound;
|
||||
m_AudioSource.Play();
|
||||
}
|
||||
if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
|
||||
{
|
||||
m_MoveDir.y = 0f;
|
||||
}
|
||||
|
||||
private void ProgressStepCycle(float speed)
|
||||
{
|
||||
if (m_CharacterController.velocity.sqrMagnitude > 0f && (m_Input.x != 0f || m_Input.y != 0f))
|
||||
{
|
||||
m_StepCycle += (m_CharacterController.velocity.magnitude + speed * (m_IsWalking ? 1f : m_RunstepLenghten)) * Time.fixedDeltaTime;
|
||||
}
|
||||
if (m_StepCycle > m_NextStep)
|
||||
{
|
||||
m_NextStep = m_StepCycle + m_StepInterval;
|
||||
PlayFootStepAudio();
|
||||
}
|
||||
}
|
||||
m_PreviouslyGrounded = m_CharacterController.isGrounded;
|
||||
}
|
||||
|
||||
private void PlayFootStepAudio()
|
||||
{
|
||||
if (!m_CharacterController.isGrounded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (groundTypeTag == "Bridge" || groundTypeTag == "Boat")
|
||||
{
|
||||
if (m_FootstepSoundsBridge.Length != 0)
|
||||
{
|
||||
int num = Random.Range(1, m_FootstepSoundsBridge.Length);
|
||||
m_AudioSource.clip = m_FootstepSoundsBridge[num];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSoundsBridge[num] = m_FootstepSoundsBridge[0];
|
||||
m_FootstepSoundsBridge[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
else if (groundTypeTag == "Stone")
|
||||
{
|
||||
if (m_FootstepSoundsStone.Length != 0)
|
||||
{
|
||||
int num2 = Random.Range(1, m_FootstepSoundsStone.Length);
|
||||
m_AudioSource.clip = m_FootstepSoundsStone[num2];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSoundsStone[num2] = m_FootstepSoundsStone[0];
|
||||
m_FootstepSoundsStone[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
else if (m_FootstepSounds.Length != 0)
|
||||
{
|
||||
int num3 = Random.Range(1, m_FootstepSounds.Length);
|
||||
m_AudioSource.clip = m_FootstepSounds[num3];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSounds[num3] = m_FootstepSounds[0];
|
||||
m_FootstepSounds[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
private void PlayLandingSound()
|
||||
{
|
||||
m_AudioSource.clip = m_LandSound;
|
||||
m_AudioSource.Play();
|
||||
m_NextStep = m_StepCycle + 0.5f;
|
||||
}
|
||||
|
||||
private void UpdateCameraPosition(float speed)
|
||||
{
|
||||
if (m_UseHeadBob)
|
||||
{
|
||||
Vector3 localPosition;
|
||||
if (m_CharacterController.velocity.magnitude > 0f && m_CharacterController.isGrounded)
|
||||
{
|
||||
m_Camera.transform.localPosition = m_HeadBob.DoHeadBob(m_CharacterController.velocity.magnitude + speed * (m_IsWalking ? 1f : m_RunstepLenghten));
|
||||
localPosition = m_Camera.transform.localPosition;
|
||||
localPosition.y = m_Camera.transform.localPosition.y - m_JumpBob.Offset();
|
||||
}
|
||||
else
|
||||
{
|
||||
localPosition = m_Camera.transform.localPosition;
|
||||
localPosition.y = m_OriginalCameraPosition.y - m_JumpBob.Offset();
|
||||
}
|
||||
m_Camera.transform.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!frezzeRotation && rotateMouseInFixedUpdate)
|
||||
{
|
||||
RotateView();
|
||||
}
|
||||
|
||||
private void GetInput(out float speed)
|
||||
{
|
||||
bool isWalking = m_IsWalking;
|
||||
m_IsWalking = !isRuning;
|
||||
speed = (m_IsWalking ? m_WalkSpeed : m_RunSpeed);
|
||||
m_Input = new Vector2(horizontal, vertical);
|
||||
if (m_Input.sqrMagnitude > 1f)
|
||||
{
|
||||
m_Input.Normalize();
|
||||
}
|
||||
if (m_IsWalking != isWalking && m_UseFovKick && m_CharacterController.velocity.sqrMagnitude > 0f)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine((!m_IsWalking) ? m_FovKick.FOVKickUp() : m_FovKick.FOVKickDown());
|
||||
}
|
||||
}
|
||||
if (frezzePosition)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void RotateView()
|
||||
{
|
||||
m_MouseLook.LookRotation(transform, m_Camera.transform);
|
||||
}
|
||||
GetInput(out var speed);
|
||||
Vector3 vector = transform.forward * m_Input.y + transform.right * m_Input.x;
|
||||
Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out var hitInfo,
|
||||
m_CharacterController.height / 2f, -1, QueryTriggerInteraction.Ignore);
|
||||
vector = Vector3.ProjectOnPlane(vector, hitInfo.normal).normalized;
|
||||
m_MoveDir.x = vector.x * speed;
|
||||
m_MoveDir.z = vector.z * speed;
|
||||
if (m_CharacterController.isGrounded)
|
||||
{
|
||||
m_MoveDir.y = 0f - m_StickToGroundForce;
|
||||
if (m_Jump && !isWater)
|
||||
{
|
||||
if ((bool)transform.parent && transform.parent.gameObject.layer == LayerMask.NameToLayer("Boat"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void UnFrezzeLook()
|
||||
{
|
||||
frezzePosition = false;
|
||||
frezzeRotation = false;
|
||||
m_MouseLook.Init(transform, m_Camera.transform);
|
||||
}
|
||||
m_MoveDir.y = m_JumpSpeed;
|
||||
PlayJumpSound();
|
||||
m_Jump = false;
|
||||
m_Jumping = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MoveDir += Physics.gravity * m_GravityMultiplier * Time.fixedDeltaTime;
|
||||
}
|
||||
|
||||
private void OnControllerColliderHit(ControllerColliderHit hit)
|
||||
{
|
||||
Rigidbody attachedRigidbody = hit.collider.attachedRigidbody;
|
||||
groundTypeTag = hit.collider.tag;
|
||||
if (!isWater && (groundTypeTag == "Terrain" || groundTypeTag == "Boat"))
|
||||
{
|
||||
lastValidPosition = transform.position;
|
||||
}
|
||||
if (m_CollisionFlags != CollisionFlags.Below && !(attachedRigidbody == null))
|
||||
{
|
||||
_ = attachedRigidbody.isKinematic;
|
||||
}
|
||||
}
|
||||
if (!notMove)
|
||||
{
|
||||
m_CollisionFlags = m_CharacterController.Move(m_MoveDir * Time.fixedDeltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.tag == "Water")
|
||||
{
|
||||
isWater = true;
|
||||
}
|
||||
}
|
||||
ProgressStepCycle(speed);
|
||||
UpdateCameraPosition(speed);
|
||||
m_MouseLook.UpdateCursorLock();
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.tag == "Water")
|
||||
{
|
||||
isWater = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void PlayJumpSound()
|
||||
{
|
||||
m_AudioSource.clip = m_JumpSound;
|
||||
m_AudioSource.Play();
|
||||
}
|
||||
|
||||
private void ProgressStepCycle(float speed)
|
||||
{
|
||||
if (m_CharacterController.velocity.sqrMagnitude > 0f && (m_Input.x != 0f || m_Input.y != 0f))
|
||||
{
|
||||
m_StepCycle +=
|
||||
(m_CharacterController.velocity.magnitude + speed * (m_IsWalking ? 1f : m_RunstepLenghten)) *
|
||||
Time.fixedDeltaTime;
|
||||
}
|
||||
|
||||
if (m_StepCycle > m_NextStep)
|
||||
{
|
||||
m_NextStep = m_StepCycle + m_StepInterval;
|
||||
PlayFootStepAudio();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayFootStepAudio()
|
||||
{
|
||||
if (!m_CharacterController.isGrounded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (groundTypeTag == "Bridge" || groundTypeTag == "Boat")
|
||||
{
|
||||
if (m_FootstepSoundsBridge.Length != 0)
|
||||
{
|
||||
int num = Random.Range(1, m_FootstepSoundsBridge.Length);
|
||||
m_AudioSource.clip = m_FootstepSoundsBridge[num];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSoundsBridge[num] = m_FootstepSoundsBridge[0];
|
||||
m_FootstepSoundsBridge[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
else if (groundTypeTag == "Stone")
|
||||
{
|
||||
if (m_FootstepSoundsStone.Length != 0)
|
||||
{
|
||||
int num2 = Random.Range(1, m_FootstepSoundsStone.Length);
|
||||
m_AudioSource.clip = m_FootstepSoundsStone[num2];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSoundsStone[num2] = m_FootstepSoundsStone[0];
|
||||
m_FootstepSoundsStone[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
else if (m_FootstepSounds.Length != 0)
|
||||
{
|
||||
int num3 = Random.Range(1, m_FootstepSounds.Length);
|
||||
m_AudioSource.clip = m_FootstepSounds[num3];
|
||||
m_AudioSource.PlayOneShot(m_AudioSource.clip, 0.3f);
|
||||
m_FootstepSounds[num3] = m_FootstepSounds[0];
|
||||
m_FootstepSounds[0] = m_AudioSource.clip;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCameraPosition(float speed)
|
||||
{
|
||||
if (m_UseHeadBob)
|
||||
{
|
||||
Vector3 localPosition;
|
||||
if (m_CharacterController.velocity.magnitude > 0f && m_CharacterController.isGrounded)
|
||||
{
|
||||
m_Camera.transform.localPosition = m_HeadBob.DoHeadBob(m_CharacterController.velocity.magnitude +
|
||||
speed *
|
||||
(m_IsWalking ? 1f : m_RunstepLenghten));
|
||||
localPosition = m_Camera.transform.localPosition;
|
||||
localPosition.y = m_Camera.transform.localPosition.y - m_JumpBob.Offset();
|
||||
}
|
||||
else
|
||||
{
|
||||
localPosition = m_Camera.transform.localPosition;
|
||||
localPosition.y = m_OriginalCameraPosition.y - m_JumpBob.Offset();
|
||||
}
|
||||
|
||||
m_Camera.transform.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetInput(out float speed)
|
||||
{
|
||||
bool isWalking = m_IsWalking;
|
||||
m_IsWalking = !isRuning;
|
||||
speed = (m_IsWalking ? m_WalkSpeed : m_RunSpeed);
|
||||
m_Input = new Vector2(horizontal, vertical);
|
||||
if (m_Input.sqrMagnitude > 1f)
|
||||
{
|
||||
m_Input.Normalize();
|
||||
}
|
||||
|
||||
if (m_IsWalking != isWalking && m_UseFovKick && m_CharacterController.velocity.sqrMagnitude > 0f)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine((!m_IsWalking) ? m_FovKick.FOVKickUp() : m_FovKick.FOVKickDown());
|
||||
}
|
||||
}
|
||||
|
||||
public void RotateView()
|
||||
{
|
||||
m_MouseLook.LookRotation(transform, m_Camera.transform);
|
||||
}
|
||||
|
||||
public void UnFrezzeLook()
|
||||
{
|
||||
frezzePosition = false;
|
||||
frezzeRotation = false;
|
||||
m_MouseLook.Init(transform, m_Camera.transform);
|
||||
}
|
||||
|
||||
private void OnControllerColliderHit(ControllerColliderHit hit)
|
||||
{
|
||||
Rigidbody attachedRigidbody = hit.collider.attachedRigidbody;
|
||||
groundTypeTag = hit.collider.tag;
|
||||
if (!isWater && (groundTypeTag == "Terrain" || groundTypeTag == "Boat"))
|
||||
{
|
||||
lastValidPosition = transform.position;
|
||||
}
|
||||
|
||||
if (m_CollisionFlags != CollisionFlags.Below && !(attachedRigidbody == null))
|
||||
{
|
||||
_ = attachedRigidbody.isKinematic;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Water"))
|
||||
{
|
||||
isWater = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Water"))
|
||||
{
|
||||
isWater = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityStandardAssets.Utility;
|
||||
|
||||
namespace UnityStandardAssets.Characters.FirstPerson
|
||||
{
|
||||
public class HeadBob : MonoBehaviour
|
||||
{
|
||||
public Camera Camera;
|
||||
|
||||
public CurveControlledBob motionBob = new CurveControlledBob();
|
||||
|
||||
public LerpControlledBob jumpAndLandingBob = new LerpControlledBob();
|
||||
|
||||
public RigidbodyFirstPersonController rigidbodyFirstPersonController;
|
||||
|
||||
public float StrideInterval;
|
||||
|
||||
[Range(0f, 1f)]
|
||||
public float RunningStrideLengthen;
|
||||
|
||||
private bool m_PreviouslyGrounded;
|
||||
|
||||
private Vector3 m_OriginalCameraPosition;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
motionBob.Setup(Camera, StrideInterval);
|
||||
m_OriginalCameraPosition = Camera.transform.localPosition;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Vector3 localPosition;
|
||||
if (rigidbodyFirstPersonController.Velocity.magnitude > 0f && rigidbodyFirstPersonController.Grounded)
|
||||
{
|
||||
Camera.transform.localPosition = motionBob.DoHeadBob(rigidbodyFirstPersonController.Velocity.magnitude * (rigidbodyFirstPersonController.Running ? RunningStrideLengthen : 1f));
|
||||
localPosition = Camera.transform.localPosition;
|
||||
localPosition.y = Camera.transform.localPosition.y - jumpAndLandingBob.Offset();
|
||||
}
|
||||
else
|
||||
{
|
||||
localPosition = Camera.transform.localPosition;
|
||||
localPosition.y = m_OriginalCameraPosition.y - jumpAndLandingBob.Offset();
|
||||
}
|
||||
Camera.transform.localPosition = localPosition;
|
||||
if (!m_PreviouslyGrounded && rigidbodyFirstPersonController.Grounded)
|
||||
{
|
||||
StartCoroutine(jumpAndLandingBob.DoBobCycle());
|
||||
}
|
||||
m_PreviouslyGrounded = rigidbodyFirstPersonController.Grounded;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39e4175b0b333c6c1d9b6b5db831f603
|
||||
timeCreated: 1716587613
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
externalObjects: {}
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,122 +1,133 @@
|
||||
using System;
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.Characters.FirstPerson
|
||||
{
|
||||
[Serializable]
|
||||
public class MouseLook
|
||||
{
|
||||
public float XSensitivity = 2f;
|
||||
[Serializable]
|
||||
public class MouseLook
|
||||
{
|
||||
public float XSensitivity = 2f;
|
||||
|
||||
public float YSensitivity = 2f;
|
||||
public float YSensitivity = 2f;
|
||||
|
||||
public bool clampVerticalRotation = true;
|
||||
public bool clampVerticalRotation = true;
|
||||
|
||||
public float MinimumX = -90f;
|
||||
public float MinimumX = -90f;
|
||||
|
||||
public float MaximumX = 90f;
|
||||
public float MaximumX = 90f;
|
||||
|
||||
public bool smooth;
|
||||
public bool smooth;
|
||||
|
||||
public float smoothTime = 5f;
|
||||
public float smoothTime = 5f;
|
||||
|
||||
public bool lockCursor = true;
|
||||
public bool lockCursor = true;
|
||||
|
||||
public float RotYvalue;
|
||||
public float RotYvalue;
|
||||
|
||||
public bool invertMouseY;
|
||||
public bool invertMouseY;
|
||||
|
||||
public bool invertMouseX;
|
||||
public bool invertMouseX;
|
||||
|
||||
public int ControllerHandMode;
|
||||
public int ControllerHandMode;
|
||||
|
||||
private Quaternion m_CharacterTargetRot;
|
||||
private Quaternion m_CharacterTargetRot;
|
||||
|
||||
private Quaternion m_CameraTargetRot;
|
||||
private Quaternion m_CameraTargetRot;
|
||||
|
||||
private bool m_cursorIsLocked = true;
|
||||
private bool m_cursorIsLocked = true;
|
||||
|
||||
// private Player player;
|
||||
// private Player player;
|
||||
|
||||
public void Init(Transform character, Transform camera)
|
||||
{
|
||||
m_CharacterTargetRot = character.localRotation;
|
||||
m_CameraTargetRot = camera.localRotation;
|
||||
// player = ReInput.players.GetPlayer(0);
|
||||
}
|
||||
public void Init(Transform character, Transform camera)
|
||||
{
|
||||
m_CharacterTargetRot = character.localRotation;
|
||||
m_CameraTargetRot = camera.localRotation;
|
||||
// player = ReInput.players.GetPlayer(0);
|
||||
}
|
||||
|
||||
public void LookRotation(Transform character, Transform camera)
|
||||
{
|
||||
// if (!SRDebug.Instance.IsDebugPanelVisible && !SRDebug.Instance.IsDebugPanelVisible)
|
||||
// {
|
||||
// float num = Mathf.Clamp(player.GetAxis("cameraVerticalGamepad") * YSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraVertical") * YSensitivity * 5f * Time.deltaTime, -10f, 10f);
|
||||
// float num2 = Mathf.Clamp(player.GetAxis("cameraHorizontalGamepad") * XSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraHorizontal") * XSensitivity * 5f * Time.deltaTime, -10f, 10f);
|
||||
// if (invertMouseY)
|
||||
// {
|
||||
// num *= -1f;
|
||||
// }
|
||||
// if (invertMouseX)
|
||||
// {
|
||||
// num2 *= -1f;
|
||||
// }
|
||||
// RotYvalue = num2;
|
||||
// m_CharacterTargetRot *= Quaternion.Euler(0f, num2, 0f);
|
||||
// m_CameraTargetRot *= Quaternion.Euler(0f - num, 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 LookRotation(Transform character, Transform camera)
|
||||
{
|
||||
// if (!SRDebug.Instance.IsDebugPanelVisible && !SRDebug.Instance.IsDebugPanelVisible)
|
||||
{
|
||||
var lookInput = InputManager.GetLookInput();
|
||||
|
||||
public void SetCursorLock(bool value)
|
||||
{
|
||||
lockCursor = value;
|
||||
if (!lockCursor)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
}
|
||||
float num = Mathf.Clamp(lookInput.y * YSensitivity * 5f * Time.deltaTime, -10f, 10f);
|
||||
float num2 =
|
||||
Mathf.Clamp(lookInput.x * XSensitivity * 5f * Time.deltaTime, -10f, 10f);
|
||||
|
||||
public void UpdateCursorLock()
|
||||
{
|
||||
if (lockCursor)
|
||||
{
|
||||
InternalLockUpdate();
|
||||
}
|
||||
}
|
||||
if (invertMouseY)
|
||||
{
|
||||
num *= -1f;
|
||||
}
|
||||
|
||||
private void InternalLockUpdate()
|
||||
{
|
||||
}
|
||||
if (invertMouseX)
|
||||
{
|
||||
num2 *= -1f;
|
||||
}
|
||||
|
||||
private Quaternion ClampRotationAroundXAxis(Quaternion q)
|
||||
{
|
||||
q.x /= q.w;
|
||||
q.y /= q.w;
|
||||
q.z /= q.w;
|
||||
q.w = 1f;
|
||||
float value = 114.59156f * Mathf.Atan(q.x);
|
||||
value = Mathf.Clamp(value, MinimumX, MaximumX);
|
||||
q.x = Mathf.Tan((float)Math.PI / 360f * value);
|
||||
return q;
|
||||
}
|
||||
}
|
||||
}
|
||||
RotYvalue = num2;
|
||||
m_CharacterTargetRot *= Quaternion.Euler(0f, num2, 0f);
|
||||
m_CameraTargetRot *= Quaternion.Euler(0f - num, 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)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCursorLock()
|
||||
{
|
||||
if (lockCursor)
|
||||
{
|
||||
InternalLockUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalLockUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
private Quaternion ClampRotationAroundXAxis(Quaternion q)
|
||||
{
|
||||
q.x /= q.w;
|
||||
q.y /= q.w;
|
||||
q.z /= q.w;
|
||||
q.w = 1f;
|
||||
float value = 114.59156f * Mathf.Atan(q.x);
|
||||
value = Mathf.Clamp(value, MinimumX, MaximumX);
|
||||
q.x = Mathf.Tan((float)Math.PI / 360f * value);
|
||||
return q;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityStandardAssets.CrossPlatformInput;
|
||||
|
||||
namespace UnityStandardAssets.Characters.FirstPerson
|
||||
{
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
[RequireComponent(typeof(CapsuleCollider))]
|
||||
public class RigidbodyFirstPersonController : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class MovementSettings
|
||||
{
|
||||
public float ForwardSpeed = 8f;
|
||||
|
||||
public float BackwardSpeed = 4f;
|
||||
|
||||
public float StrafeSpeed = 4f;
|
||||
|
||||
public float RunMultiplier = 2f;
|
||||
|
||||
public KeyCode RunKey = KeyCode.LeftShift;
|
||||
|
||||
public float JumpForce = 30f;
|
||||
|
||||
public AnimationCurve SlopeCurveModifier = new AnimationCurve(new Keyframe(-90f, 1f), new Keyframe(0f, 1f), new Keyframe(90f, 0f));
|
||||
|
||||
[HideInInspector]
|
||||
public float CurrentTargetSpeed = 8f;
|
||||
|
||||
private bool m_Running;
|
||||
|
||||
public bool Running => m_Running;
|
||||
|
||||
public void UpdateDesiredTargetSpeed(Vector2 input)
|
||||
{
|
||||
if (!(input == Vector2.zero))
|
||||
{
|
||||
if (input.x > 0f || input.x < 0f)
|
||||
{
|
||||
CurrentTargetSpeed = StrafeSpeed;
|
||||
}
|
||||
if (input.y < 0f)
|
||||
{
|
||||
CurrentTargetSpeed = BackwardSpeed;
|
||||
}
|
||||
if (input.y > 0f)
|
||||
{
|
||||
CurrentTargetSpeed = ForwardSpeed;
|
||||
}
|
||||
if (Input.GetKey(RunKey))
|
||||
{
|
||||
CurrentTargetSpeed *= RunMultiplier;
|
||||
m_Running = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AdvancedSettings
|
||||
{
|
||||
public float groundCheckDistance = 0.01f;
|
||||
|
||||
public float stickToGroundHelperDistance = 0.5f;
|
||||
|
||||
public float slowDownRate = 20f;
|
||||
|
||||
public bool airControl;
|
||||
|
||||
[Tooltip("set it to 0.1 or more if you get stuck in wall")]
|
||||
public float shellOffset;
|
||||
}
|
||||
|
||||
public Camera cam;
|
||||
|
||||
public MovementSettings movementSettings = new MovementSettings();
|
||||
|
||||
public MouseLook mouseLook = new MouseLook();
|
||||
|
||||
public AdvancedSettings advancedSettings = new AdvancedSettings();
|
||||
|
||||
private Rigidbody m_RigidBody;
|
||||
|
||||
private CapsuleCollider m_Capsule;
|
||||
|
||||
private float m_YRotation;
|
||||
|
||||
private Vector3 m_GroundContactNormal;
|
||||
|
||||
private bool m_Jump;
|
||||
|
||||
private bool m_PreviouslyGrounded;
|
||||
|
||||
private bool m_Jumping;
|
||||
|
||||
private bool m_IsGrounded;
|
||||
|
||||
public Vector3 Velocity => m_RigidBody.linearVelocity;
|
||||
|
||||
public bool Grounded => m_IsGrounded;
|
||||
|
||||
public bool Jumping => m_Jumping;
|
||||
|
||||
public bool Running => movementSettings.Running;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_RigidBody = GetComponent<Rigidbody>();
|
||||
m_Capsule = GetComponent<CapsuleCollider>();
|
||||
mouseLook.Init(transform, cam.transform);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
RotateView();
|
||||
if (CrossPlatformInputManager.GetButtonDown("Jump") && !m_Jump)
|
||||
{
|
||||
m_Jump = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
GroundCheck();
|
||||
Vector2 input = GetInput();
|
||||
if ((Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon) && (advancedSettings.airControl || m_IsGrounded))
|
||||
{
|
||||
Vector3 vector = cam.transform.forward * input.y + cam.transform.right * input.x;
|
||||
vector = Vector3.ProjectOnPlane(vector, m_GroundContactNormal).normalized;
|
||||
vector.x *= movementSettings.CurrentTargetSpeed;
|
||||
vector.z *= movementSettings.CurrentTargetSpeed;
|
||||
vector.y *= movementSettings.CurrentTargetSpeed;
|
||||
if (m_RigidBody.linearVelocity.sqrMagnitude < movementSettings.CurrentTargetSpeed * movementSettings.CurrentTargetSpeed)
|
||||
{
|
||||
m_RigidBody.AddForce(vector * SlopeMultiplier(), ForceMode.Impulse);
|
||||
}
|
||||
}
|
||||
if (m_IsGrounded)
|
||||
{
|
||||
m_RigidBody.linearDamping = 5f;
|
||||
if (m_Jump)
|
||||
{
|
||||
m_RigidBody.linearDamping = 0f;
|
||||
m_RigidBody.linearVelocity = new Vector3(m_RigidBody.linearVelocity.x, 0f, m_RigidBody.linearVelocity.z);
|
||||
m_RigidBody.AddForce(new Vector3(0f, movementSettings.JumpForce, 0f), ForceMode.Impulse);
|
||||
m_Jumping = true;
|
||||
}
|
||||
if (!m_Jumping && Mathf.Abs(input.x) < float.Epsilon && Mathf.Abs(input.y) < float.Epsilon && m_RigidBody.linearVelocity.magnitude < 1f)
|
||||
{
|
||||
m_RigidBody.Sleep();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RigidBody.linearDamping = 0f;
|
||||
if (m_PreviouslyGrounded && !m_Jumping)
|
||||
{
|
||||
StickToGroundHelper();
|
||||
}
|
||||
}
|
||||
m_Jump = false;
|
||||
}
|
||||
|
||||
private float SlopeMultiplier()
|
||||
{
|
||||
float time = Vector3.Angle(m_GroundContactNormal, Vector3.up);
|
||||
return movementSettings.SlopeCurveModifier.Evaluate(time);
|
||||
}
|
||||
|
||||
private void StickToGroundHelper()
|
||||
{
|
||||
if (Physics.SphereCast(transform.position, m_Capsule.radius * (1f - advancedSettings.shellOffset), Vector3.down, out var hitInfo, m_Capsule.height / 2f - m_Capsule.radius + advancedSettings.stickToGroundHelperDistance, -1, QueryTriggerInteraction.Ignore) && Mathf.Abs(Vector3.Angle(hitInfo.normal, Vector3.up)) < 85f)
|
||||
{
|
||||
m_RigidBody.linearVelocity = Vector3.ProjectOnPlane(m_RigidBody.linearVelocity, hitInfo.normal);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 GetInput()
|
||||
{
|
||||
Vector2 vector = default(Vector2);
|
||||
vector.x = CrossPlatformInputManager.GetAxis("Horizontal");
|
||||
vector.y = CrossPlatformInputManager.GetAxis("Vertical");
|
||||
Vector2 vector2 = vector;
|
||||
movementSettings.UpdateDesiredTargetSpeed(vector2);
|
||||
return vector2;
|
||||
}
|
||||
|
||||
private void RotateView()
|
||||
{
|
||||
if (!(Mathf.Abs(Time.timeScale) < float.Epsilon))
|
||||
{
|
||||
float y = transform.eulerAngles.y;
|
||||
mouseLook.LookRotation(transform, cam.transform);
|
||||
if (m_IsGrounded || advancedSettings.airControl)
|
||||
{
|
||||
Quaternion quaternion = Quaternion.AngleAxis(transform.eulerAngles.y - y, Vector3.up);
|
||||
m_RigidBody.linearVelocity = quaternion * m_RigidBody.linearVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GroundCheck()
|
||||
{
|
||||
m_PreviouslyGrounded = m_IsGrounded;
|
||||
if (Physics.SphereCast(transform.position, m_Capsule.radius * (1f - advancedSettings.shellOffset), Vector3.down, out var hitInfo, m_Capsule.height / 2f - m_Capsule.radius + advancedSettings.groundCheckDistance, -1, QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
m_IsGrounded = true;
|
||||
m_GroundContactNormal = hitInfo.normal;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IsGrounded = false;
|
||||
m_GroundContactNormal = Vector3.up;
|
||||
}
|
||||
if (!m_PreviouslyGrounded && m_IsGrounded && m_Jumping)
|
||||
{
|
||||
m_Jumping = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3facfead7f1a8f983f2d3f5f1e3b3e48
|
||||
timeCreated: 1716587613
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
externalObjects: {}
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,5 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIMGUIContainer_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4f75f0eb2d14004826911645c6175d61fbe00_003F49_003F22dd7281_003FIMGUIContainer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AKeyCode_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003Fd1_003F01a95d3a_003FKeyCode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARenderChain_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4f75f0eb2d14004826911645c6175d61fbe00_003Fde_003Fedac53d9_003FRenderChain_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASphereCollider_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F03ef825315384b1cab81c4b53eb03d922ac00_003F31_003F871dbbe1_003FSphereCollider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,17 +21,17 @@ EditorUserSettings:
|
||||
value: 020056535456585e0f0d0a7541210d441215482c2d297f36752c1b65b3b0376e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 5a010607560c0c0d5857547441745c44434e4e2c287824322e7a1b35b5b6626f
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 565702035151590e5e0f547140745b44154f4a7a2f7c72657f2d4465e4e3676e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
RecentlyUsedSceneGuid-6:
|
||||
value: 0150055704510808545c0a26467506444516197a747874637b7e1860b5b6616c
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
flags: 0
|
||||
|
||||
Reference in New Issue
Block a user