add throwable hand
This commit is contained in:
+1357
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
public class Flashlight : Tool
|
public class Flashlight : Tool
|
||||||
{
|
{
|
||||||
|
[Header("Flashlight Parameters")]
|
||||||
public Light lightSrc;
|
public Light lightSrc;
|
||||||
|
|
||||||
public override void Use()
|
public override void Use()
|
||||||
|
|||||||
@@ -5615,6 +5615,17 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 46.475, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 46.475, z: 0}
|
||||||
|
--- !u!114 &1446259105 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 6033266832729015012, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 7959480261809233915}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe5aedf75d904534296ad0d07fe55622, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::Throwable
|
||||||
--- !u!1 &1475998728
|
--- !u!1 &1475998728
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -7922,6 +7933,14 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 1480974628599415149, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
|
propertyPath: tools.Array.size
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1480974628599415149, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
|
propertyPath: 'tools.Array.data[2]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1446259105}
|
||||||
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -0.60945
|
value: -0.60945
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ public Image GetBlackScreen()
|
|||||||
return Instance.blackScreen;
|
return Instance.blackScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the playerContoller object reference
|
||||||
|
/// </summary>
|
||||||
|
public PlayerController GetPlayerController()
|
||||||
|
{
|
||||||
|
return Instance.playerController;
|
||||||
|
}
|
||||||
|
|
||||||
#region Storybool Save/Load
|
#region Storybool Save/Load
|
||||||
public void SaveStoryBools(ref StoryboolSaveData data)
|
public void SaveStoryBools(ref StoryboolSaveData data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ void Start()
|
|||||||
characterController = GetComponent<CharacterController>();
|
characterController = GetComponent<CharacterController>();
|
||||||
cameraController = GetComponent<CameraController>();
|
cameraController = GetComponent<CameraController>();
|
||||||
SwitchTools(GameManager.Instance.PlayerManager.CurrentToolIndex);
|
SwitchTools(GameManager.Instance.PlayerManager.CurrentToolIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
public class Shovel : Tool
|
public class Shovel : Tool
|
||||||
{
|
{
|
||||||
|
[Header("Shovel Parameters")]
|
||||||
public Animator shovelAnimator;
|
public Animator shovelAnimator;
|
||||||
|
|
||||||
public override void Use()
|
public override void Use()
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
public abstract class Tool : MonoBehaviour
|
public abstract class Tool : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[Header("Base Tool Parameters")]
|
||||||
public float useTimeSec;
|
public float useTimeSec;
|
||||||
public float altUseTimeSec;
|
public float altUseTimeSec;
|
||||||
public bool inUse;
|
public bool inUse;
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7529463216777598777
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6754763150105653226}
|
||||||
|
- component: {fileID: 8008322410806594511}
|
||||||
|
- component: {fileID: 5659607169736183288}
|
||||||
|
- component: {fileID: 6701693895616936011}
|
||||||
|
- component: {fileID: 5800804362539127280}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TestTnt
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6754763150105653226
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7529463216777598777}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: -1.262, y: 3.7159793, z: -2.631}
|
||||||
|
m_LocalScale: {x: 0.054245003, y: 0.054245, z: 0.054245003}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &8008322410806594511
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7529463216777598777}
|
||||||
|
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &5659607169736183288
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7529463216777598777}
|
||||||
|
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_ForceMeshLod: -1
|
||||||
|
m_MeshLodSelectionBias: 0
|
||||||
|
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_GlobalIlluminationMeshLod: 0
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_MaskInteraction: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!136 &6701693895616936011
|
||||||
|
CapsuleCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7529463216777598777}
|
||||||
|
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.5000001
|
||||||
|
m_Height: 2
|
||||||
|
m_Direction: 1
|
||||||
|
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
|
||||||
|
--- !u!54 &5800804362539127280
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7529463216777598777}
|
||||||
|
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: 0
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea8f36f5e928823469cf3d0ebc62afc7
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
using static UnityEngine.GraphicsBuffer;
|
||||||
|
|
||||||
|
public class ThrowableHand : Tool
|
||||||
|
{
|
||||||
|
[Header("Throwable Hand Parameters")]
|
||||||
|
public float range;
|
||||||
|
public float forceModifier;
|
||||||
|
public float loft;
|
||||||
|
public GameObject testBomb;
|
||||||
|
|
||||||
|
// Mathematical plane used to catch the raycast from camera to get direction for
|
||||||
|
// looking at the mouse
|
||||||
|
private Plane handGroundPlane;
|
||||||
|
private DecalProjector targetProjection;
|
||||||
|
private float throwForce;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (GameManager.Instance.GetPlayerController() != null)
|
||||||
|
{
|
||||||
|
SetGroundPlane();
|
||||||
|
DrawTargetProjection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetGroundPlane()
|
||||||
|
{
|
||||||
|
if (handGroundPlane == null)
|
||||||
|
{
|
||||||
|
handGroundPlane = new Plane(Vector3.up, -GameManager.Instance.GetPlayerController().DougBody.transform.position.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
handGroundPlane.distance = -GameManager.Instance.GetPlayerController().DougBody.transform.position.y;
|
||||||
|
handGroundPlane.normal = Vector3.up;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawTargetProjection()
|
||||||
|
{
|
||||||
|
if (targetProjection == null)
|
||||||
|
{
|
||||||
|
targetProjection = GetComponentInChildren<DecalProjector>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||||
|
|
||||||
|
if (handGroundPlane.Raycast(ray, out var distance))
|
||||||
|
{
|
||||||
|
Vector3 hitPoint = ray.GetPoint(distance);
|
||||||
|
|
||||||
|
float distanceFromPoint = Vector3.Distance(hitPoint, transform.position);
|
||||||
|
if (distanceFromPoint > range)
|
||||||
|
{
|
||||||
|
Vector3 directionTowardMouse = (hitPoint - transform.position).normalized;
|
||||||
|
targetProjection.transform.position = new Vector3(transform.position.x, hitPoint.y, transform.position.z);
|
||||||
|
targetProjection.transform.position += directionTowardMouse * range;
|
||||||
|
|
||||||
|
throwForce = range;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetProjection.gameObject.SetActive(true);
|
||||||
|
targetProjection.transform.position = hitPoint;
|
||||||
|
throwForce = distanceFromPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Use()
|
||||||
|
{
|
||||||
|
GameObject newBomb = Instantiate(testBomb);
|
||||||
|
newBomb.transform.position = transform.position;
|
||||||
|
|
||||||
|
Vector3 direction = transform.forward * throwForce * forceModifier;
|
||||||
|
direction.y = loft;
|
||||||
|
|
||||||
|
newBomb.GetComponent<Rigidbody>().AddForce(direction, ForceMode.Impulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UseAlt()
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fe5aedf75d904534296ad0d07fe55622
|
||||||
Reference in New Issue
Block a user