Movement feels good :)
This commit is contained in:
4893
Assets/Boom.prefab
Normal file
4893
Assets/Boom.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Boom.prefab.meta
Normal file
7
Assets/Boom.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cb374b3f206928074a601efa815a321e
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
26
Assets/Discharge.cs
Normal file
26
Assets/Discharge.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public class Discharge : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float boomRadius;
|
||||||
|
public float boomForce;
|
||||||
|
public float fakeUp;
|
||||||
|
|
||||||
|
public void Explode() {
|
||||||
|
foreach (Collider hit in Physics.OverlapSphere(
|
||||||
|
transform.position,
|
||||||
|
boomRadius
|
||||||
|
)) {
|
||||||
|
if (hit.attachedRigidbody == null) continue;
|
||||||
|
hit.attachedRigidbody.AddExplosionForce(
|
||||||
|
boomForce,
|
||||||
|
transform.position,
|
||||||
|
boomRadius,
|
||||||
|
fakeUp,
|
||||||
|
ForceMode.Impulse
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Discharge.cs.meta
Normal file
2
Assets/Discharge.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 78536e927bb12ab49a587868d601eddb
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"name": "Attack",
|
"name": "Attack",
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
|
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"name": "Interact",
|
"name": "Interact",
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
"id": "852140f2-7766-474d-8707-702459ba45f3",
|
"id": "852140f2-7766-474d-8707-702459ba45f3",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "Hold",
|
"interactions": "Hold",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
@@ -432,7 +432,7 @@
|
|||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "1c04ea5f-b012-41d1-a6f7-02e963b52893",
|
"id": "1c04ea5f-b012-41d1-a6f7-02e963b52893",
|
||||||
"path": "<Keyboard>/e",
|
"path": "<Mouse>/rightButton",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "Keyboard&Mouse",
|
"groups": "Keyboard&Mouse",
|
||||||
|
|||||||
297
Assets/Player.prefab
Normal file
297
Assets/Player.prefab
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5163371848492923623
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8024010922766677031}
|
||||||
|
- component: {fileID: 3303839552944989391}
|
||||||
|
- component: {fileID: 1431277691403868330}
|
||||||
|
- component: {fileID: 4822670519660386375}
|
||||||
|
m_Layer: 6
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8024010922766677031
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5163371848492923623}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0.5, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 3304489094637627623}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!20 &3303839552944989391
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5163371848492923623}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_Iso: 200
|
||||||
|
m_ShutterSpeed: 0.005
|
||||||
|
m_Aperture: 16
|
||||||
|
m_FocusDistance: 10
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_BladeCount: 5
|
||||||
|
m_Curvature: {x: 2, y: 11}
|
||||||
|
m_BarrelClipping: 0.25
|
||||||
|
m_Anamorphism: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 0
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!81 &1431277691403868330
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5163371848492923623}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!114 &4822670519660386375
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5163371848492923623}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_RenderShadows: 1
|
||||||
|
m_RequiresDepthTextureOption: 2
|
||||||
|
m_RequiresOpaqueTextureOption: 2
|
||||||
|
m_CameraType: 0
|
||||||
|
m_Cameras: []
|
||||||
|
m_RendererIndex: -1
|
||||||
|
m_VolumeLayerMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 1
|
||||||
|
m_VolumeTrigger: {fileID: 0}
|
||||||
|
m_VolumeFrameworkUpdateModeOption: 2
|
||||||
|
m_RenderPostProcessing: 1
|
||||||
|
m_Antialiasing: 0
|
||||||
|
m_AntialiasingQuality: 2
|
||||||
|
m_StopNaN: 0
|
||||||
|
m_Dithering: 0
|
||||||
|
m_ClearDepth: 1
|
||||||
|
m_AllowXRRendering: 1
|
||||||
|
m_AllowHDROutput: 1
|
||||||
|
m_UseScreenCoordOverride: 0
|
||||||
|
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_RequiresDepthTexture: 0
|
||||||
|
m_RequiresColorTexture: 0
|
||||||
|
m_Version: 2
|
||||||
|
m_TaaSettings:
|
||||||
|
m_Quality: 3
|
||||||
|
m_FrameInfluence: 0.1
|
||||||
|
m_JitterScale: 1
|
||||||
|
m_MipBias: 0
|
||||||
|
m_VarianceClampScale: 0.9
|
||||||
|
m_ContrastAdaptiveSharpening: 0
|
||||||
|
--- !u!1 &6105902072964728863
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3304489094637627623}
|
||||||
|
- component: {fileID: 7685267554069840356}
|
||||||
|
- component: {fileID: 3907047792586774900}
|
||||||
|
- component: {fileID: 259646022855321368}
|
||||||
|
- component: {fileID: 7859354295828299192}
|
||||||
|
- component: {fileID: 3933398178849621920}
|
||||||
|
m_Layer: 6
|
||||||
|
m_Name: Player
|
||||||
|
m_TagString: Player
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3304489094637627623
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0.10515027, y: 1.38, z: 3.990589}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 8024010922766677031}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &7685267554069840356
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &3907047792586774900
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!136 &259646022855321368
|
||||||
|
CapsuleCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Height: 2
|
||||||
|
m_Direction: 1
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &7859354295828299192
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b2228f9d6eb8d5c8b9bee880d018e9b1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
moveSpeed: 10
|
||||||
|
jumpStrength: 3
|
||||||
|
airSpeed: 0.5
|
||||||
|
mouseSens: 0.5
|
||||||
|
throwStrength: 10
|
||||||
|
discharge: {fileID: 0}
|
||||||
|
--- !u!54 &3933398178849621920
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6105902072964728863}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 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: 112
|
||||||
|
m_CollisionDetection: 1
|
||||||
7
Assets/Player.prefab.meta
Normal file
7
Assets/Player.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1c163a2d95cbcd7cca5767464f168f2b
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -2,17 +2,21 @@ using UnityEngine;
|
|||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class playerController : MonoBehaviour
|
public class PlayerController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float moveSpeed;
|
public float moveSpeed;
|
||||||
public float jumpStrength;
|
public float jumpStrength;
|
||||||
public float airSpeed;
|
public float airSpeed;
|
||||||
public float mouseSens;
|
public float mouseSens;
|
||||||
|
public float throwStrength;
|
||||||
|
public GameObject discharge;
|
||||||
|
public bool grounded;
|
||||||
InputAction move;
|
InputAction move;
|
||||||
InputAction jump;
|
InputAction jump;
|
||||||
InputAction look;
|
InputAction look;
|
||||||
|
InputAction click;
|
||||||
float camVertRot = 0f;
|
float camVertRot = 0f;
|
||||||
bool grounded;
|
Queue<GameObject> discharges;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -21,40 +25,98 @@ public class playerController : MonoBehaviour
|
|||||||
move = InputSystem.actions.FindAction("Move");
|
move = InputSystem.actions.FindAction("Move");
|
||||||
jump = InputSystem.actions.FindAction("Jump");
|
jump = InputSystem.actions.FindAction("Jump");
|
||||||
look = InputSystem.actions.FindAction("Look");
|
look = InputSystem.actions.FindAction("Look");
|
||||||
|
discharges = new Queue<GameObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
Vector2 movement = move.ReadValue<Vector2>().normalized;
|
Vector2 movement = move.ReadValue<Vector2>().normalized;
|
||||||
Vector2 lookment = look.ReadValue<Vector2>();
|
Vector2 lookment = look.ReadValue<Vector2>();
|
||||||
if (grounded) {
|
|
||||||
GetComponent<Rigidbody>().linearVelocity = transform.TransformVector(new Vector3 (
|
if (grounded) MoveGrounded(movement);
|
||||||
|
else MoveAirborne(movement);
|
||||||
|
|
||||||
|
MoveCamera(lookment);
|
||||||
|
|
||||||
|
if (InputSystem.actions.FindAction("Attack").WasPressedThisFrame())
|
||||||
|
Throw();
|
||||||
|
|
||||||
|
if (InputSystem.actions.FindAction("Interact").WasPressedThisFrame())
|
||||||
|
discharges.Dequeue().GetComponent<Discharge>().Explode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoveGrounded(Vector2 movement) {
|
||||||
|
Rigidbody rb = GetComponent<Rigidbody>();
|
||||||
|
|
||||||
|
if (jump.IsPressed()) {
|
||||||
|
Vector3 moveVelocity = transform.TransformVector (
|
||||||
movement.x * moveSpeed,
|
movement.x * moveSpeed,
|
||||||
(jump.IsPressed()) ? jumpStrength : 0,
|
jumpStrength,
|
||||||
movement.y * moveSpeed
|
movement.y * moveSpeed
|
||||||
));
|
|
||||||
} else {
|
|
||||||
GetComponent<Rigidbody>().AddForce(
|
|
||||||
movement.x * airSpeed,
|
|
||||||
0,
|
|
||||||
movement.y * airSpeed
|
|
||||||
);
|
);
|
||||||
|
Vector3 currVelocity = new Vector3 (
|
||||||
|
rb.linearVelocity.x,
|
||||||
|
jumpStrength,
|
||||||
|
rb.linearVelocity.z
|
||||||
|
);
|
||||||
|
if (movement.Equals(Vector2.zero)) {
|
||||||
|
rb.linearVelocity =
|
||||||
|
transform.forward *
|
||||||
|
currVelocity.magnitude;
|
||||||
|
}
|
||||||
|
rb.linearVelocity =
|
||||||
|
moveVelocity.normalized * currVelocity.magnitude;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
rb.linearVelocity = transform.TransformVector(
|
||||||
|
movement.x * moveSpeed,
|
||||||
|
0,
|
||||||
|
movement.y * moveSpeed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoveAirborne(Vector2 movement) {
|
||||||
|
GetComponent<Rigidbody>().AddForce(transform.TransformVector(
|
||||||
|
movement.x * airSpeed,
|
||||||
|
0,
|
||||||
|
movement.y * airSpeed
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoveCamera(Vector2 lookment) {
|
||||||
gameObject.transform.Rotate(0, lookment.x * mouseSens, 0);
|
gameObject.transform.Rotate(0, lookment.x * mouseSens, 0);
|
||||||
camVertRot -= lookment.y * mouseSens;
|
camVertRot -= lookment.y * mouseSens;
|
||||||
camVertRot = Mathf.Clamp(camVertRot, -90f, 90f);
|
camVertRot = Mathf.Clamp(camVertRot, -89f, 89f);
|
||||||
foreach (Transform child in transform) {
|
transform.GetChild(0).localEulerAngles =
|
||||||
child.localEulerAngles = Vector3.right * camVertRot;
|
Vector3.right * camVertRot;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void Throw() {
|
||||||
|
GameObject thrown = Instantiate(
|
||||||
|
discharge,
|
||||||
|
GetComponentInChildren<Transform>().position,
|
||||||
|
Quaternion.identity
|
||||||
|
);
|
||||||
|
Physics.IgnoreCollision(
|
||||||
|
GetComponent<Collider>(),
|
||||||
|
thrown.GetComponent<Collider>()
|
||||||
|
);
|
||||||
|
thrown.GetComponent<Rigidbody>().linearVelocity =
|
||||||
|
GetComponent<Rigidbody>().linearVelocity;
|
||||||
|
thrown.GetComponent<Rigidbody>().AddForce(
|
||||||
|
transform.GetChild(0).forward * throwStrength,
|
||||||
|
ForceMode.VelocityChange
|
||||||
|
);
|
||||||
|
discharges.Enqueue(thrown);
|
||||||
|
}
|
||||||
|
|
||||||
private bool checkgrounded(Collision col) {
|
private bool checkgrounded(Collision col) {
|
||||||
List<ContactPoint> points = new List<ContactPoint>();
|
List<ContactPoint> points = new List<ContactPoint>();
|
||||||
col.GetContacts(points);
|
col.GetContacts(points);
|
||||||
foreach (ContactPoint contactPoint in points) {
|
foreach (ContactPoint contactPoint in points) {
|
||||||
if (contactPoint.point.y < gameObject.transform.position.y - 0.95) {
|
if (contactPoint.point.y <
|
||||||
return true;
|
gameObject.transform.position.y - 0.95
|
||||||
}
|
) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ MonoBehaviour:
|
|||||||
moveSpeed: 10
|
moveSpeed: 10
|
||||||
jumpStrength: 3
|
jumpStrength: 3
|
||||||
airSpeed: 0.5
|
airSpeed: 0.5
|
||||||
|
mouseSens: 0.3
|
||||||
|
throwStrength: 30
|
||||||
|
discharge: {fileID: 5537760923326018756, guid: 88547c51f293c36cf8c00d85b42f86d5, type: 3}
|
||||||
|
grounded: 0
|
||||||
--- !u!136 &179192984
|
--- !u!136 &179192984
|
||||||
CapsuleCollider:
|
CapsuleCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -272,7 +276,7 @@ Rigidbody:
|
|||||||
m_UseGravity: 1
|
m_UseGravity: 1
|
||||||
m_IsKinematic: 0
|
m_IsKinematic: 0
|
||||||
m_Interpolate: 0
|
m_Interpolate: 0
|
||||||
m_Constraints: 80
|
m_Constraints: 112
|
||||||
m_CollisionDetection: 1
|
m_CollisionDetection: 1
|
||||||
--- !u!43 &197508218
|
--- !u!43 &197508218
|
||||||
Mesh:
|
Mesh:
|
||||||
@@ -832,7 +836,7 @@ MeshRenderer:
|
|||||||
m_IgnoreNormalsForChartDetection: 0
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
m_ImportantGI: 0
|
m_ImportantGI: 0
|
||||||
m_StitchLightmapSeams: 1
|
m_StitchLightmapSeams: 1
|
||||||
m_SelectedEditorRenderState: 2
|
m_SelectedEditorRenderState: 3
|
||||||
m_MinimumChartSize: 4
|
m_MinimumChartSize: 4
|
||||||
m_AutoUVMaxDistance: 0.5
|
m_AutoUVMaxDistance: 0.5
|
||||||
m_AutoUVMaxAngle: 89
|
m_AutoUVMaxAngle: 89
|
||||||
@@ -1067,7 +1071,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 872307021}
|
m_GameObject: {fileID: 872307021}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -0, y: 0.094, z: 0.869}
|
m_LocalPosition: {x: -0, y: 0.094, z: 0.47}
|
||||||
m_LocalScale: {x: 1, y: 1.4687, z: 0.81548077}
|
m_LocalScale: {x: 1, y: 1.4687, z: 0.81548077}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|||||||
154
Assets/Sphere.prefab
Normal file
154
Assets/Sphere.prefab
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5537760923326018756
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2673743819048013161}
|
||||||
|
- component: {fileID: 5091154303768981785}
|
||||||
|
- component: {fileID: 135390491856743999}
|
||||||
|
- component: {fileID: 2342520249982657009}
|
||||||
|
- component: {fileID: 1913938627097006002}
|
||||||
|
- component: {fileID: -539519356720630437}
|
||||||
|
m_Layer: 3
|
||||||
|
m_Name: Sphere
|
||||||
|
m_TagString: Discharge
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2673743819048013161
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 3.3384235, y: 2.020582, z: 4.337}
|
||||||
|
m_LocalScale: {x: 0.3, y: 0.3, z: 0.3}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &5091154303768981785
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &135390491856743999
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!135 &2342520249982657009
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!54 &1913938627097006002
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 2
|
||||||
|
m_AngularDrag: 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
|
||||||
|
--- !u!114 &-539519356720630437
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5537760923326018756}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 78536e927bb12ab49a587868d601eddb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
boomRadius: 10
|
||||||
|
boomForce: 20
|
||||||
|
fakeUp: 0
|
||||||
7
Assets/Sphere.prefab.meta
Normal file
7
Assets/Sphere.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88547c51f293c36cf8c00d85b42f86d5
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user