Compare commits
11 Commits
8a9c23d1fe
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ecd6d4cd7 | |||
| 89551b49f3 | |||
| 70d60bfcd9 | |||
| a98e003edc | |||
| bc5cf80f30 | |||
| 80be13ce72 | |||
| 4de639cdd7 | |||
|
|
ef170ca6c6 | ||
|
|
178432179b | ||
|
|
50a5d8c527 | ||
|
|
a057798e3e |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
276
Assets/PlayerControls.inputactions
Normal file
276
Assets/PlayerControls.inputactions
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"name": "PlayerControls",
|
||||||
|
"maps": [
|
||||||
|
{
|
||||||
|
"name": "Walking",
|
||||||
|
"id": "1e7ba32d-4065-405c-9b0c-fe0b09743eb3",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"name": "Walk",
|
||||||
|
"type": "Value",
|
||||||
|
"id": "3a2bd67d-4457-4f11-b1fc-c86379804bb1",
|
||||||
|
"expectedControlType": "Vector2",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Attack",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "f8dcb10a-f2c6-43c1-9aaf-f11c20421cd1",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jump",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "cec6d443-6127-4956-b159-38ca8562aa98",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pause",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "5c32bd40-94aa-43cd-8964-7cc6e6fe0841",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Look",
|
||||||
|
"type": "Value",
|
||||||
|
"id": "7fba5b60-8d24-49b6-8308-c70e6a63c456",
|
||||||
|
"expectedControlType": "Vector2",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "5a6630db-ebaf-4fde-9e52-f04136a77988",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Interact",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "659c7039-016f-46e9-948a-517daf323bd7",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "Tap,Hold",
|
||||||
|
"initialStateCheck": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bindings": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "2a3f4ee7-cbd7-4664-984f-750f150f8d63",
|
||||||
|
"path": "<Gamepad>/leftStick",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "2D Vector",
|
||||||
|
"id": "f127319e-6995-4349-bc8a-8d71b1b1c9f9",
|
||||||
|
"path": "2DVector",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": true,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "up",
|
||||||
|
"id": "a90b9406-f8c9-41a6-acf9-073de4d92e91",
|
||||||
|
"path": "<Keyboard>/w",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "down",
|
||||||
|
"id": "1bebfb21-bb71-4512-9291-6f0500a3d82b",
|
||||||
|
"path": "<Keyboard>/s",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "left",
|
||||||
|
"id": "07a58494-4f87-4c68-a0ac-f51461fb40a5",
|
||||||
|
"path": "<Keyboard>/a",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "right",
|
||||||
|
"id": "cc51b20a-9c2b-464f-9f63-f83e8bcc34f0",
|
||||||
|
"path": "<Keyboard>/d",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Walk",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "2b5b52b2-8b25-451e-a6b7-8cf81f0d050f",
|
||||||
|
"path": "<Gamepad>/rightTrigger",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Attack",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "fe8bd868-92c9-4b6e-9bc5-14344cb2b727",
|
||||||
|
"path": "<Mouse>/leftButton",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Attack",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "6471cb05-e4f9-4cdc-809c-2629fdee010a",
|
||||||
|
"path": "<Gamepad>/buttonSouth",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Jump",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "20ba707d-cf88-4683-9ad7-2a705b1129c6",
|
||||||
|
"path": "<Keyboard>/space",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Jump",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "4e0041d6-e3b6-4e5e-88db-fa3dd30b2c4c",
|
||||||
|
"path": "<Gamepad>/start",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Pause",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "abbc102c-00c8-4291-bfa3-39ed3704b6e8",
|
||||||
|
"path": "<Keyboard>/escape",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Pause",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "74ebb1b9-ab13-42d0-956f-019b25fb646b",
|
||||||
|
"path": "<Gamepad>/rightStick",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Look",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "2c4bb4fd-6d38-4424-a2de-e798aeef5dd7",
|
||||||
|
"path": "<Mouse>/delta",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Look",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "ac8271b8-5a0c-498a-b97b-57546775b0b9",
|
||||||
|
"path": "<Gamepad>/leftStickPress",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Run",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "34fcda37-2f7d-40e9-a510-fff20ecd0672",
|
||||||
|
"path": "<Keyboard>/leftShift",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Run",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "045d63b8-c118-4d79-a439-5f1fc422a65f",
|
||||||
|
"path": "<Gamepad>/buttonNorth",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Interact",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "96d963c4-bd8d-4dd6-a8c7-fa55d8318aa2",
|
||||||
|
"path": "<Keyboard>/f",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Interact",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"controlSchemes": []
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 052faaac586de48259a63d0c4782560b
|
guid: 96337c2766116244abd3c3ed43585709
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -13,6 +13,7 @@ GameObject:
|
|||||||
- component: {fileID: 3900353858553251828}
|
- component: {fileID: 3900353858553251828}
|
||||||
- component: {fileID: 2064409223717511053}
|
- component: {fileID: 2064409223717511053}
|
||||||
- component: {fileID: 7066644236778025839}
|
- component: {fileID: 7066644236778025839}
|
||||||
|
- component: {fileID: 6393509116105302420}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: ThrownGun
|
m_Name: ThrownGun
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -28,13 +29,13 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 6611039685471789196}
|
m_GameObject: {fileID: 6611039685471789196}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.4, y: 0.5, z: 0.4}
|
m_LocalScale: {x: 0.4, y: 0.5, z: 0.4}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
|
||||||
--- !u!33 &5688607449888095492
|
--- !u!33 &5688607449888095492
|
||||||
MeshFilter:
|
MeshFilter:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -126,5 +127,37 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: fe870c030a2b648d89c63559e7522299, type: 3}
|
m_Script: {fileID: 11500000, guid: fe870c030a2b648d89c63559e7522299, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::GunThrown
|
m_EditorClassIdentifier: Assembly-CSharp::GunThrown
|
||||||
|
rb: {fileID: 6393509116105302420}
|
||||||
player: {fileID: 0}
|
player: {fileID: 0}
|
||||||
TargetPosition: {x: 0, y: 0, z: 0}
|
TargetPosition: {x: 0, y: 0, z: 0}
|
||||||
|
currentRotation: {x: 0, y: 0, z: 0}
|
||||||
|
targetRotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
isStuck: 0
|
||||||
|
despawnTimer: 10
|
||||||
|
--- !u!54 &6393509116105302420
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6611039685471789196}
|
||||||
|
serializedVersion: 5
|
||||||
|
m_Mass: 1
|
||||||
|
m_LinearDamping: 0
|
||||||
|
m_AngularDamping: 0.05
|
||||||
|
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||||
|
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||||
|
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ImplicitCom: 1
|
||||||
|
m_ImplicitTensor: 1
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 1
|
||||||
|
|||||||
BIN
Assets/Scenes/Scene1-1.unity
LFS
BIN
Assets/Scenes/Scene1-1.unity
LFS
Binary file not shown.
@@ -2,24 +2,65 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class GunThrown : MonoBehaviour
|
public class GunThrown : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public Rigidbody rb;
|
||||||
public GameObject player;
|
public GameObject player;
|
||||||
public Vector3 TargetPosition;
|
public Vector3 TargetPosition;
|
||||||
|
public float playerDistance;
|
||||||
|
|
||||||
|
public Vector3 currentRotation;
|
||||||
|
public Quaternion targetRotation;
|
||||||
|
|
||||||
|
public bool isStuck;
|
||||||
|
public float despawnTimer = 10;
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
player = GameObject.Find("Player");
|
player = GameObject.Find("Player");
|
||||||
TargetPosition = player.transform.position;
|
TargetPosition = player.transform.position;
|
||||||
|
transform.LookAt(player.transform.position);
|
||||||
|
currentRotation = transform.eulerAngles;
|
||||||
|
transform.eulerAngles = new Vector3(60, currentRotation.y, currentRotation.z);
|
||||||
|
|
||||||
|
playerDistance = Vector3.Distance(transform.position, TargetPosition);
|
||||||
|
if (playerDistance < 9)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance * 1.2f;
|
||||||
|
}
|
||||||
|
if (playerDistance > 16)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance / 1.4f;
|
||||||
|
}
|
||||||
|
else if (playerDistance > 13)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance / 1.2f;
|
||||||
|
}
|
||||||
|
rb.AddForce(transform.up * playerDistance, ForceMode.Impulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 10 * Time.deltaTime);
|
//transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 10 * Time.deltaTime);
|
||||||
|
|
||||||
|
|
||||||
|
if (transform.position == TargetPosition)
|
||||||
|
{
|
||||||
|
isStuck = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStuck)
|
||||||
|
{
|
||||||
|
despawnTimer -= Time.deltaTime;
|
||||||
|
if (despawnTimer <= 0)
|
||||||
|
{
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCollisionEnter(Collision collision)
|
private void OnCollisionStay(Collision collision)
|
||||||
{
|
{
|
||||||
if (collision.gameObject.tag == "Player")
|
if (collision.gameObject.tag == "Player" && !isStuck)
|
||||||
{
|
{
|
||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.InputSystem.Interactions;
|
||||||
|
|
||||||
public class MouthOpenClose : MonoBehaviour
|
public class MouthOpenClose : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -59,11 +61,11 @@ public class MouthOpenClose : MonoBehaviour
|
|||||||
prompt.SetActive(true);
|
prompt.SetActive(true);
|
||||||
if (Input.GetKeyDown(KeyCode.E))
|
if (Input.GetKeyDown(KeyCode.E))
|
||||||
{
|
{
|
||||||
interacted = true;
|
//interacted = true;
|
||||||
prompt.SetActive(false);
|
//prompt.SetActive(false);
|
||||||
text.SetActive(true);
|
//text.SetActive(true);
|
||||||
text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
//text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||||
timerDeactivate = initialTimerDeactivate;
|
//timerDeactivate = initialTimerDeactivate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -120,10 +122,27 @@ public class MouthOpenClose : MonoBehaviour
|
|||||||
if (text.GetComponent<TextMeshProUGUI>().text != whatToSay) interacted = false;
|
if (text.GetComponent<TextMeshProUGUI>().text != whatToSay) interacted = false;
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.C))
|
if (Input.GetKeyDown(KeyCode.C))
|
||||||
|
{
|
||||||
|
//text.SetActive(false);
|
||||||
|
//interacted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnInteract(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed && !interacted && Vector3.Distance(transform.position, player.transform.position) < 3 && context.interaction is TapInteraction)
|
||||||
|
{
|
||||||
|
interacted = true;
|
||||||
|
prompt.SetActive(false);
|
||||||
|
text.SetActive(true);
|
||||||
|
text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||||
|
timerDeactivate = initialTimerDeactivate;
|
||||||
|
}
|
||||||
|
if (context.performed && context.interaction is HoldInteraction)
|
||||||
{
|
{
|
||||||
text.SetActive(false);
|
text.SetActive(false);
|
||||||
interacted = false;
|
interacted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ public class PauseMenuControls : MonoBehaviour
|
|||||||
public TextMeshProUGUI SensitvityShow;
|
public TextMeshProUGUI SensitvityShow;
|
||||||
public GameObject Sens;
|
public GameObject Sens;
|
||||||
|
|
||||||
public Canvas mainCanvas;
|
public GameObject mainCanvas;
|
||||||
public Canvas pauseCanvas;
|
public GameObject pauseCanvas;
|
||||||
public Canvas settingsCanvas;
|
public GameObject settingsCanvas;
|
||||||
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@@ -148,9 +148,9 @@ public class PauseMenuControls : MonoBehaviour
|
|||||||
|
|
||||||
public void ResumeGame()
|
public void ResumeGame()
|
||||||
{
|
{
|
||||||
mainCanvas.enabled = true;
|
mainCanvas.SetActive(true);
|
||||||
pauseCanvas.enabled = false;
|
pauseCanvas.SetActive(false);
|
||||||
settingsCanvas.enabled = false;
|
settingsCanvas.SetActive(false);
|
||||||
Time.timeScale = 1;
|
Time.timeScale = 1;
|
||||||
Cursor.lockState = CursorLockMode.Locked;
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
Cursor.visible = false;
|
Cursor.visible = false;
|
||||||
@@ -163,12 +163,12 @@ public class PauseMenuControls : MonoBehaviour
|
|||||||
|
|
||||||
public void OpenSettings()
|
public void OpenSettings()
|
||||||
{
|
{
|
||||||
pauseCanvas.enabled = false;
|
pauseCanvas.SetActive(false);
|
||||||
settingsCanvas.enabled = true;
|
settingsCanvas.SetActive(true);
|
||||||
}
|
}
|
||||||
public void CloseSettings()
|
public void CloseSettings()
|
||||||
{
|
{
|
||||||
settingsCanvas.enabled = false;
|
settingsCanvas.SetActive(false);
|
||||||
pauseCanvas.enabled = true;
|
pauseCanvas.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ public class PlayerCam : MonoBehaviour
|
|||||||
{
|
{
|
||||||
float sens;
|
float sens;
|
||||||
public Transform orientation;
|
public Transform orientation;
|
||||||
|
public Transform player;
|
||||||
float xRotation;
|
float xRotation;
|
||||||
float yRotation;
|
float yRotation;
|
||||||
float mouseX;
|
public Vector2 lookInput;
|
||||||
float mouseY;
|
|
||||||
public Transform wagonRot;
|
public Transform wagonRot;
|
||||||
private Quaternion previousSourceRotation;
|
private Quaternion previousSourceRotation;
|
||||||
|
|
||||||
@@ -51,19 +51,19 @@ public class PlayerCam : MonoBehaviour
|
|||||||
sens = Sensitivity.value;
|
sens = Sensitivity.value;
|
||||||
if (canLook)
|
if (canLook)
|
||||||
{
|
{
|
||||||
mouseX = Input.GetAxis("Mouse X") * sens;
|
yRotation += lookInput.x * sens * 50 * Time.deltaTime;
|
||||||
mouseY = Input.GetAxis("Mouse Y") * sens;
|
xRotation -= lookInput.y * sens * 50 * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
yRotation += mouseX;
|
|
||||||
xRotation -= mouseY;
|
|
||||||
xRotation = Mathf.Clamp(xRotation, -87f, 87f);
|
xRotation = Mathf.Clamp(xRotation, -87f, 87f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
|
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
|
||||||
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
|
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
|
||||||
|
player.rotation = Quaternion.Euler(0, yRotation, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,29 @@ using UnityEngine.Rendering.PostProcessing;
|
|||||||
using UnityEngine.Rendering.Universal;
|
using UnityEngine.Rendering.Universal;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerMovement : MonoBehaviour
|
public class PlayerMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float moveSpeed;
|
public CharacterController controller;
|
||||||
public float moveSpeedMultiplier;
|
private Vector2 moveInput;
|
||||||
|
private float moveAnimationInputX;
|
||||||
|
private float moveAnimationInputY;
|
||||||
|
private Vector3 velocity;
|
||||||
|
public float speed;
|
||||||
|
public float runSpeed;
|
||||||
|
public float gravity;
|
||||||
|
public float jumpHeight;
|
||||||
|
public PlayerCam playerCam;
|
||||||
|
public bool canWalk;
|
||||||
|
float walkResetTimer;
|
||||||
|
bool walkResetTimerGo;
|
||||||
|
bool running;
|
||||||
|
|
||||||
public LayerMask whatIsGround;
|
|
||||||
public bool grounded;
|
|
||||||
public Collider groundedCollider;
|
|
||||||
public float airMultiplier;
|
|
||||||
public bool airCollided;
|
|
||||||
public bool groundCollided;
|
|
||||||
|
|
||||||
public float maxSlopeAngle;
|
public InputAction pauseGameButton;
|
||||||
private RaycastHit slopeHit;
|
|
||||||
private bool exitingSlope;
|
|
||||||
|
|
||||||
public Transform orientation;
|
public Transform orientation;
|
||||||
public Transform cameraor;
|
public Transform cameraor;
|
||||||
@@ -39,6 +46,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
public float timeSinceLastSwing;
|
public float timeSinceLastSwing;
|
||||||
public bool holdSwing;
|
public bool holdSwing;
|
||||||
public float holdSwingTimer;
|
public float holdSwingTimer;
|
||||||
|
public bool swingBeingHeld;
|
||||||
|
|
||||||
public float dashDistanceTimer, dashDistance, dashDuration;
|
public float dashDistanceTimer, dashDistance, dashDuration;
|
||||||
public Collider myCollider;
|
public Collider myCollider;
|
||||||
@@ -56,38 +64,97 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
float energyObjTimer;
|
float energyObjTimer;
|
||||||
public GameObject energyFill;
|
public GameObject energyFill;
|
||||||
|
|
||||||
Vector3 moveDirection;
|
public bool jumped;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rigidbody rb;
|
|
||||||
|
|
||||||
public PhysicsMaterial walkingPhysics;
|
|
||||||
public PhysicsMaterial standingPhysics;
|
|
||||||
public PhysicsMaterial airColliding;
|
|
||||||
|
|
||||||
public GameObject particle1;
|
|
||||||
public GameObject particle2;
|
|
||||||
public VolumeProfile volumeProfile;
|
|
||||||
|
|
||||||
public RectTransform healthUI;
|
public RectTransform healthUI;
|
||||||
bool jumped;
|
|
||||||
bool jumping;
|
|
||||||
|
|
||||||
public GameObject uiController;
|
public GameObject uiController;
|
||||||
|
|
||||||
|
public PlayerInput playerInput;
|
||||||
|
|
||||||
|
InputAction jumpAction;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
jumpAction = playerInput.actions["Jump"];
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
cinemachineCam = GameObject.Find("CinemachineCamera");
|
cinemachineCam = GameObject.Find("CinemachineCamera");
|
||||||
rb = GetComponent<Rigidbody>();
|
canWalk = true;
|
||||||
rb.freezeRotation = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
MyInput();
|
|
||||||
SpeedControl();
|
|
||||||
|
|
||||||
|
|
||||||
|
timeSinceLastSwing += Time.deltaTime;
|
||||||
|
if (timeSinceLastSwing > .5f)
|
||||||
|
lastSwing = 0;
|
||||||
|
|
||||||
|
holdSwingTimer += Time.deltaTime;
|
||||||
|
if (holdSwing && holdSwingTimer > .15f)
|
||||||
|
holdSwing = false;
|
||||||
|
else if (holdSwing && GameObject.FindGameObjectsWithTag("Sword").Length < 1)
|
||||||
|
{
|
||||||
|
holdSwing = false;
|
||||||
|
if (energy > 7)
|
||||||
|
SwingSword();
|
||||||
|
}
|
||||||
|
if (!holdSwing)
|
||||||
|
holdSwingTimer = 0;
|
||||||
|
|
||||||
|
if (swung)
|
||||||
|
{
|
||||||
|
swungTimer += Time.deltaTime;
|
||||||
|
}
|
||||||
|
if (swungTimer > 1f)
|
||||||
|
swung = false;
|
||||||
|
if (!swung)
|
||||||
|
{
|
||||||
|
swungTimer = 0;
|
||||||
|
energy += 70 * Time.deltaTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (energy < 0)
|
||||||
|
energy = 0;
|
||||||
|
if (energy > 100)
|
||||||
|
energy = 100;
|
||||||
|
|
||||||
|
energySlider.value = energy;
|
||||||
|
|
||||||
|
healthUI.sizeDelta = new Vector2((Mathf.Ceil(HP) - 1) + (9 * HP), healthUI.sizeDelta.y);
|
||||||
|
|
||||||
|
//MyInput();
|
||||||
|
if (swingBeingHeld)
|
||||||
|
{
|
||||||
|
swung = true;
|
||||||
|
swungTimer = 0;
|
||||||
|
timeSinceLastSwing = 0;
|
||||||
|
|
||||||
|
energy -= 20 * Time.deltaTime;
|
||||||
|
dashDistanceTimer += Time.deltaTime;
|
||||||
|
if (dashDistanceTimer > 1)
|
||||||
|
energyFill.GetComponent<Image>().color = Color.deepPink;
|
||||||
|
if (energy <= 0)
|
||||||
|
{
|
||||||
|
if (dashDistanceTimer > 1)
|
||||||
|
{
|
||||||
|
dashDistance = Mathf.Floor(dashDistanceTimer * 8);
|
||||||
|
dashDuration = 15;
|
||||||
|
}
|
||||||
|
dashDistanceTimer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (energy == 100)
|
if (energy == 100)
|
||||||
{
|
{
|
||||||
energyObjTimer += Time.deltaTime;
|
energyObjTimer += Time.deltaTime;
|
||||||
@@ -102,114 +169,158 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
energyObjTimer = 0;
|
energyObjTimer = 0;
|
||||||
energyObj.SetActive(true);
|
energyObj.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (dashDuration > 0)
|
||||||
|
{
|
||||||
|
SwordDash();
|
||||||
|
|
||||||
|
dashDuration--;
|
||||||
|
}
|
||||||
|
if (dashDuration == 1)
|
||||||
|
{
|
||||||
|
//rb.linearVelocity = Vector3.zero;
|
||||||
|
|
||||||
|
dashDuration--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (controller.isGrounded && velocity.y < 0)
|
||||||
|
{
|
||||||
|
velocity.y = -0.5f;
|
||||||
|
|
||||||
|
}
|
||||||
|
//else if (controller.isGrounded && !jumpAction.WasPerformedThisFrame())
|
||||||
|
//{
|
||||||
|
// velocity.y = 0;
|
||||||
|
//}
|
||||||
|
if (jumpAction.WasPerformedThisFrame() && controller.isGrounded)
|
||||||
|
{
|
||||||
|
//Debug.Log("jumped");
|
||||||
|
//velocity.y = Mathf.Sqrt(jumpHeight * -1f * gravity);
|
||||||
|
}
|
||||||
|
|
||||||
|
velocity.y += gravity * Time.deltaTime;
|
||||||
|
|
||||||
|
//Debug.Log(controller.isGrounded);
|
||||||
|
|
||||||
|
if (canWalk /*&& !running*/)
|
||||||
|
{
|
||||||
|
Vector3 move = new Vector3(moveInput.x * speed, 0, moveInput.y * speed);
|
||||||
|
Vector3 move2 = transform.TransformDirection(move);
|
||||||
|
controller.Move(move2 * Time.deltaTime);
|
||||||
|
}
|
||||||
|
//else if (canWalk && running)
|
||||||
|
//{
|
||||||
|
// Vector3 move = new Vector3(moveInput.x * speed, 0, moveInput.y * runSpeed);
|
||||||
|
// Vector3 move2 = transform.TransformDirection(move);
|
||||||
|
// controller.Move(move2 * Time.deltaTime);
|
||||||
|
//}
|
||||||
|
controller.Move(velocity * Time.deltaTime);
|
||||||
}
|
}
|
||||||
void FixedUpdate()
|
public void PauseGame(InputAction.CallbackContext context)
|
||||||
{
|
{
|
||||||
MovePlayer();
|
if (Time.timeScale == 1 && context.performed)
|
||||||
|
{
|
||||||
|
uiController.GetComponent<PauseMenuControls>().mainCanvas.SetActive(false);
|
||||||
|
uiController.GetComponent<PauseMenuControls>().pauseCanvas.SetActive(true);
|
||||||
|
Time.timeScale = 0;
|
||||||
|
Cursor.lockState = CursorLockMode.None;
|
||||||
|
Cursor.visible = true;
|
||||||
|
}
|
||||||
|
else if (context.performed)
|
||||||
|
{
|
||||||
|
uiController.GetComponent<PauseMenuControls>().mainCanvas.SetActive(true);
|
||||||
|
uiController.GetComponent<PauseMenuControls>().pauseCanvas.SetActive(false);
|
||||||
|
uiController.GetComponent<PauseMenuControls>().settingsCanvas.SetActive(false);
|
||||||
|
Time.timeScale = 1;
|
||||||
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
|
Cursor.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnMove(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
moveInput = context.ReadValue<Vector2>();
|
||||||
|
}
|
||||||
|
public void OnRun(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed && moveAnimationInputY == 1 && !running)
|
||||||
|
{
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
else if (context.performed && moveAnimationInputY == 2 && running)
|
||||||
|
{
|
||||||
|
running = false;
|
||||||
|
moveAnimationInputY = 1;
|
||||||
|
}
|
||||||
|
if (context.canceled)
|
||||||
|
{
|
||||||
|
//running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnLook(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
playerCam.lookInput = context.ReadValue<Vector2>();
|
||||||
|
}
|
||||||
|
public void OnAttack(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed && inventorySlot == 1)
|
||||||
|
{
|
||||||
|
swingBeingHeld = true;
|
||||||
|
if (GameObject.FindGameObjectsWithTag("Sword").Length < 1)
|
||||||
|
{
|
||||||
|
if (energy > 7)
|
||||||
|
SwingSword();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swung = true;
|
||||||
|
swungTimer = 0;
|
||||||
|
holdSwingTimer = 0;
|
||||||
|
holdSwing = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (context.canceled && inventorySlot == 1)
|
||||||
|
{
|
||||||
|
swingBeingHeld = false;
|
||||||
|
energyFill.GetComponent<Image>().color = Color.darkRed;
|
||||||
|
if (dashDistanceTimer > 1)
|
||||||
|
{
|
||||||
|
dashDistance = Mathf.Floor(dashDistanceTimer * 8);
|
||||||
|
dashDuration = 15;
|
||||||
|
}
|
||||||
|
dashDistanceTimer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnJump(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed && controller.isGrounded)
|
||||||
|
{
|
||||||
|
velocity.y = Mathf.Sqrt(jumpHeight * -1f * gravity);
|
||||||
|
jumped = true;
|
||||||
|
}
|
||||||
|
if (context.canceled && !controller.isGrounded)
|
||||||
|
{
|
||||||
|
jumped = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void MyInput()
|
private void MyInput()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha7))
|
|
||||||
{
|
|
||||||
HP -= 1;
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha8))
|
|
||||||
{
|
|
||||||
HP -= .5f;
|
|
||||||
}
|
|
||||||
if (Input.GetKey(KeyCode.Alpha9))
|
|
||||||
{
|
|
||||||
HP -= Time.deltaTime;
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha6))
|
|
||||||
{
|
|
||||||
HP = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
|
||||||
{
|
|
||||||
inventorySlot = 1;
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha2))
|
|
||||||
{
|
|
||||||
inventorySlot = 2;
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
|
||||||
{
|
|
||||||
inventorySlot = 3;
|
|
||||||
}
|
|
||||||
if (inventorySlot > 3)
|
|
||||||
inventorySlot = 3;
|
|
||||||
if (inventorySlot < 1)
|
|
||||||
inventorySlot = 1;
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Escape))
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
{
|
{
|
||||||
if (Time.timeScale == 1)
|
|
||||||
{
|
|
||||||
uiController.GetComponent<PauseMenuControls>().mainCanvas.enabled = false;
|
|
||||||
uiController.GetComponent<PauseMenuControls>().pauseCanvas.enabled = true;
|
|
||||||
Time.timeScale = 0;
|
|
||||||
Cursor.lockState = CursorLockMode.None;
|
|
||||||
Cursor.visible = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uiController.GetComponent<PauseMenuControls>().mainCanvas.enabled = true;
|
|
||||||
uiController.GetComponent<PauseMenuControls>().pauseCanvas.enabled = false;
|
|
||||||
uiController.GetComponent<PauseMenuControls>().settingsCanvas.enabled = false;
|
|
||||||
Time.timeScale = 1;
|
|
||||||
Cursor.lockState = CursorLockMode.Locked;
|
|
||||||
Cursor.visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
horizontalInput = Input.GetAxisRaw("Horizontal");
|
horizontalInput = Input.GetAxisRaw("Horizontal");
|
||||||
verticalInput = Input.GetAxisRaw("Vertical");
|
verticalInput = Input.GetAxisRaw("Vertical");
|
||||||
if (horizontalInput == 0 && verticalInput == 0 && grounded && !Input.GetKeyDown(KeyCode.Space))
|
|
||||||
{
|
|
||||||
rb.linearDamping = 7;
|
|
||||||
|
|
||||||
GetComponent<CapsuleCollider>().material = standingPhysics;
|
|
||||||
}
|
|
||||||
else if (horizontalInput != 0 || verticalInput != 0 || !grounded || Input.GetKeyDown(KeyCode.Space))
|
|
||||||
{
|
|
||||||
rb.linearDamping = 0;
|
|
||||||
|
|
||||||
GetComponent<CapsuleCollider>().material = walkingPhysics;
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.Space) && grounded)
|
|
||||||
{
|
|
||||||
rb.linearDamping = 0;
|
|
||||||
|
|
||||||
GetComponent<CapsuleCollider>().material = walkingPhysics;
|
|
||||||
jumped = true;
|
|
||||||
jumping = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jumped)
|
|
||||||
{
|
|
||||||
rb.linearDamping = 0;
|
|
||||||
|
|
||||||
GetComponent<CapsuleCollider>().material = walkingPhysics;
|
|
||||||
if (jumping)
|
|
||||||
{
|
|
||||||
rb.AddForce(Vector3.up * 6, ForceMode.Impulse);
|
|
||||||
jumping = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (airCollided && !grounded)
|
|
||||||
{
|
|
||||||
rb.linearDamping = 0;
|
|
||||||
GetComponent<CapsuleCollider>().material = airColliding;
|
|
||||||
//rb.AddForce(Vector3.down * 1, ForceMode.Force);
|
|
||||||
Debug.Log("ng, hs");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -313,10 +424,6 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void LateUpdate()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void SwingSword()
|
private void SwingSword()
|
||||||
{
|
{
|
||||||
@@ -345,22 +452,8 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private void MovePlayer()
|
private void MovePlayer()
|
||||||
{
|
{
|
||||||
moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;
|
|
||||||
|
|
||||||
|
|
||||||
if (grounded)
|
|
||||||
rb.AddForce(moveDirection.normalized * moveSpeed * moveSpeedMultiplier * 3, ForceMode.Force);
|
|
||||||
|
|
||||||
else if (!grounded)
|
|
||||||
rb.AddForce(moveDirection.normalized * moveSpeed * moveSpeedMultiplier * airMultiplier, ForceMode.Force);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (rb.linearVelocity.y < -1)
|
|
||||||
{
|
|
||||||
rb.AddForce(transform.up * -5, ForceMode.Force);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dashDuration > 0)
|
if (dashDuration > 0)
|
||||||
{
|
{
|
||||||
SwordDash();
|
SwordDash();
|
||||||
@@ -369,7 +462,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (dashDuration == 1)
|
if (dashDuration == 1)
|
||||||
{
|
{
|
||||||
rb.linearVelocity = Vector3.zero;
|
//rb.linearVelocity = Vector3.zero;
|
||||||
|
|
||||||
dashDuration--;
|
dashDuration--;
|
||||||
}
|
}
|
||||||
@@ -377,91 +470,13 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
private void SwordDash()
|
private void SwordDash()
|
||||||
{
|
{
|
||||||
myCollider.excludeLayers = excludeEnemy;
|
myCollider.excludeLayers = excludeEnemy;
|
||||||
|
Debug.Log($"distance:{dashDistance}");
|
||||||
rb.AddForce(Camera.main.transform.forward * dashDistance, ForceMode.Impulse);
|
//rb.AddForce(Camera.main.transform.forward * dashDistance, ForceMode.Impulse);
|
||||||
|
controller.Move(Camera.main.transform.forward * dashDistance / 15);
|
||||||
swung = true;
|
swung = true;
|
||||||
swungTimer = 0;
|
swungTimer = 0;
|
||||||
timeSinceLastSwing = 0;
|
timeSinceLastSwing = 0;
|
||||||
}
|
}
|
||||||
private void SpeedControl()
|
|
||||||
{
|
|
||||||
|
|
||||||
{
|
|
||||||
Vector3 flatVel = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity.z);
|
|
||||||
|
|
||||||
if (flatVel.magnitude > moveSpeed)
|
|
||||||
{
|
|
||||||
Vector3 limitedVel = flatVel.normalized * moveSpeed;
|
|
||||||
rb.linearVelocity = new Vector3(limitedVel.x, rb.linearVelocity.y, limitedVel.z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private bool OnSlope()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (Physics.Raycast(transform.position, Vector3.down, out slopeHit, 2 * 0.5f + 0.3f))
|
|
||||||
{
|
|
||||||
float angle = Vector3.Angle(Vector3.up, slopeHit.normal);
|
|
||||||
return angle < maxSlopeAngle && angle != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
private Vector3 GetSlopeDirection()
|
|
||||||
{
|
|
||||||
return Vector3.ProjectOnPlane(moveDirection, slopeHit.normal).normalized;
|
|
||||||
}
|
|
||||||
private void OnTriggerEnter(Collider other)
|
|
||||||
{
|
|
||||||
if (other.gameObject.tag == "Enemy")
|
|
||||||
{
|
|
||||||
HP--;
|
|
||||||
}
|
|
||||||
if (!other.isTrigger/* && other.gameObject.tag == "Ground"*/)
|
|
||||||
{
|
|
||||||
|
|
||||||
grounded = true;
|
|
||||||
if (jumped)
|
|
||||||
jumped = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnTriggerStay(Collider other)
|
|
||||||
{
|
|
||||||
if (!other.isTrigger/* && other.gameObject.tag == "Ground"*/)
|
|
||||||
{
|
|
||||||
|
|
||||||
grounded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnTriggerExit(Collider other)
|
|
||||||
{
|
|
||||||
if (!other.isTrigger/* && other.gameObject.tag == "Ground"*/)
|
|
||||||
{
|
|
||||||
grounded = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnCollisionEnter(Collision collision)
|
|
||||||
{
|
|
||||||
if (!grounded)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnCollisionStay(Collision collision)
|
|
||||||
{
|
|
||||||
if (!grounded)
|
|
||||||
{
|
|
||||||
airCollided = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnCollisionExit(Collision collision)
|
|
||||||
{
|
|
||||||
if (!grounded)
|
|
||||||
{
|
|
||||||
airCollided = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ThrowerEnemy : MonoBehaviour
|
|||||||
playerDistance = Vector3.Distance(transform.position, target.position);
|
playerDistance = Vector3.Distance(transform.position, target.position);
|
||||||
if (playerDistance < 25 && canThrow)
|
if (playerDistance < 25 && canThrow)
|
||||||
{
|
{
|
||||||
Instantiate(GunThrow, transform);
|
Instantiate(GunThrow, transform.position, Quaternion.identity);
|
||||||
canThrow = false;
|
canThrow = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
110
Assets/models/suyfgdsigdsug.fbx.meta
Normal file
110
Assets/models/suyfgdsigdsug.fbx.meta
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c6075395625eb49c4bafb0ef86f449eb
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 24200
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
materials:
|
||||||
|
materialImportMode: 2
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
materialLocation: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
resampleCurves: 1
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
removeConstantScaleCurves: 0
|
||||||
|
motionNodeName:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
importAnimatedCustomProperties: 0
|
||||||
|
importConstraints: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: 0.5
|
||||||
|
animationPositionError: 0.5
|
||||||
|
animationScaleError: 0.5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
extraUserProperties: []
|
||||||
|
clipAnimations: []
|
||||||
|
isReadable: 0
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 1
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
useSRGBMaterialColor: 1
|
||||||
|
sortHierarchyByName: 1
|
||||||
|
importPhysicalCameras: 1
|
||||||
|
importVisibility: 1
|
||||||
|
importBlendShapes: 1
|
||||||
|
importCameras: 1
|
||||||
|
importLights: 1
|
||||||
|
nodeNameCollisionStrategy: 1
|
||||||
|
fileIdsGeneration: 2
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
bakeAxisConversion: 0
|
||||||
|
preserveHierarchy: 0
|
||||||
|
skinWeightsMode: 0
|
||||||
|
maxBonesPerVertex: 4
|
||||||
|
minBoneWeight: 0.001
|
||||||
|
optimizeBones: 1
|
||||||
|
generateMeshLods: 0
|
||||||
|
meshLodGenerationFlags: 0
|
||||||
|
maximumMeshLod: -1
|
||||||
|
meshOptimizationFlags: -1
|
||||||
|
indexFormat: 0
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVMarginMethod: 1
|
||||||
|
secondaryUVMinLightmapResolution: 40
|
||||||
|
secondaryUVMinObjectScale: 1
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
strictVertexDataChecks: 0
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 3
|
||||||
|
normalCalculationMode: 4
|
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
blendShapeNormalImportMode: 1
|
||||||
|
normalSmoothingSource: 0
|
||||||
|
referencedClips: []
|
||||||
|
importAnimation: 1
|
||||||
|
humanDescription:
|
||||||
|
serializedVersion: 3
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: 0.5
|
||||||
|
foreArmTwist: 0.5
|
||||||
|
upperLegTwist: 0.5
|
||||||
|
legTwist: 0.5
|
||||||
|
armStretch: 0.05
|
||||||
|
legStretch: 0.05
|
||||||
|
feetSpacing: 0
|
||||||
|
globalScale: 1
|
||||||
|
rootMotionBoneName:
|
||||||
|
hasTranslationDoF: 0
|
||||||
|
hasExtraRoot: 0
|
||||||
|
skeletonHasParents: 1
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1
|
||||||
|
animationType: 2
|
||||||
|
humanoidOversampling: 1
|
||||||
|
avatarSetup: 0
|
||||||
|
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||||
|
importBlendShapeDeformPercent: 1
|
||||||
|
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
"com.unity.2d.aseprite": "2.0.2",
|
"com.unity.2d.aseprite": "2.0.2",
|
||||||
"com.unity.ai.navigation": "2.0.9",
|
"com.unity.ai.navigation": "2.0.9",
|
||||||
"com.unity.cinemachine": "3.1.4",
|
"com.unity.cinemachine": "3.1.4",
|
||||||
"com.unity.collab-proxy": "2.9.3",
|
"com.unity.collab-proxy": "2.10.2",
|
||||||
"com.unity.ide.rider": "3.0.38",
|
"com.unity.ide.rider": "3.0.38",
|
||||||
"com.unity.ide.visualstudio": "2.0.23",
|
"com.unity.ide.visualstudio": "2.0.25",
|
||||||
"com.unity.inputsystem": "1.14.2",
|
"com.unity.inputsystem": "1.14.2",
|
||||||
"com.unity.multiplayer.center": "1.0.0",
|
"com.unity.multiplayer.center": "1.0.0",
|
||||||
"com.unity.postprocessing": "3.5.1",
|
"com.unity.postprocessing": "3.5.1",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.burst": {
|
"com.unity.burst": {
|
||||||
"version": "1.8.24",
|
"version": "1.8.25",
|
||||||
"depth": 2,
|
"depth": 2,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -71,18 +71,18 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.collab-proxy": {
|
"com.unity.collab-proxy": {
|
||||||
"version": "2.9.3",
|
"version": "2.10.2",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.collections": {
|
"com.unity.collections": {
|
||||||
"version": "2.5.7",
|
"version": "2.6.2",
|
||||||
"depth": 2,
|
"depth": 2,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.burst": "1.8.19",
|
"com.unity.burst": "1.8.23",
|
||||||
"com.unity.mathematics": "1.3.2",
|
"com.unity.mathematics": "1.3.2",
|
||||||
"com.unity.test-framework": "1.4.6",
|
"com.unity.test-framework": "1.4.6",
|
||||||
"com.unity.nuget.mono-cecil": "1.11.5",
|
"com.unity.nuget.mono-cecil": "1.11.5",
|
||||||
@@ -106,11 +106,11 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.visualstudio": {
|
"com.unity.ide.visualstudio": {
|
||||||
"version": "2.0.23",
|
"version": "2.0.25",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.test-framework": "1.1.9"
|
"com.unity.test-framework": "1.1.31"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"com.unity.splines": {
|
"com.unity.splines": {
|
||||||
"version": "2.8.1",
|
"version": "2.8.2",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.test-framework": {
|
"com.unity.test-framework": {
|
||||||
"version": "1.5.1",
|
"version": "1.6.0",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "builtin",
|
"source": "builtin",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"com.unity.test-framework.performance": {
|
"com.unity.test-framework.performance": {
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"depth": 3,
|
"depth": 3,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 6000.2.1f1
|
m_EditorVersion: 6000.2.13f1
|
||||||
m_EditorVersionWithRevision: 6000.2.1f1 (55300504c302)
|
m_EditorVersionWithRevision: 6000.2.13f1 (abdb44fca7f7)
|
||||||
|
|||||||
Reference in New Issue
Block a user