Add campfire fuel mechanic, audio mixer, lighting

This commit is contained in:
Jens Pitkänen 2020-04-19 01:30:27 +03:00
parent d03bbf6f97
commit e188567fef
24 changed files with 1008 additions and 394 deletions

8
Assets/Audio Mixers.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d8fb8780a85770846b14b024d4bf1c29
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,173 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!243 &-2967980135314984734
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ambient
m_AudioMixer: {fileID: 24100000}
m_GroupID: ecc30646201221445ab5a1cd672c78d8
m_Children: []
m_Volume: f61e9e8888930534e91c19809f219fe6
m_Pitch: 0d5d3def77582e44081f3b36f180a38e
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 3581666672454972537}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!243 &-267709887311468707
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Effects
m_AudioMixer: {fileID: 24100000}
m_GroupID: 1bdb8c14a13a7064e887fd8c05bd43e7
m_Children: []
m_Volume: fd01f6bdeaa870c4688fa6fcad7c3e41
m_Pitch: fc8fd2fca838b3843a92c252855b9146
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 1928862306469247254}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!241 &24100000
AudioMixerController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MainMixer
m_OutputGroup: {fileID: 0}
m_MasterGroup: {fileID: 24300002}
m_Snapshots:
- {fileID: 24500006}
m_StartSnapshot: {fileID: 24500006}
m_SuspendThreshold: -80
m_EnableSuspend: 1
m_UpdateMode: 0
m_ExposedParameters: []
m_AudioMixerGroupViews:
- guids:
- cce571dfddcbc694fa5856a9866157f8
- 1bdb8c14a13a7064e887fd8c05bd43e7
- ecc30646201221445ab5a1cd672c78d8
- 440e1443b72e9e449a0e30e04101552d
name: View
m_CurrentViewIndex: 0
m_TargetSnapshot: {fileID: 24500006}
--- !u!243 &24300002
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Master
m_AudioMixer: {fileID: 24100000}
m_GroupID: cce571dfddcbc694fa5856a9866157f8
m_Children:
- {fileID: -267709887311468707}
- {fileID: -2967980135314984734}
- {fileID: 586271417499195193}
m_Volume: 1dc5725402baaca40b189e10927dfd5f
m_Pitch: 91120b7d67bf787459cb1cee82330d2f
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 24400004}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &24400004
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 95aa08715333fc74e91e4a6901af43c9
m_EffectName: Attenuation
m_MixLevel: cace4e66d83ecc741a96258498de0f03
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!245 &24500006
AudioMixerSnapshotController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Snapshot
m_AudioMixer: {fileID: 24100000}
m_SnapshotID: ff8dc610a6ec0d14cb32ecaf12b55eb7
m_FloatValues: {}
m_TransitionOverrides: {}
--- !u!243 &586271417499195193
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Footsteps
m_AudioMixer: {fileID: 24100000}
m_GroupID: 440e1443b72e9e449a0e30e04101552d
m_Children: []
m_Volume: fb57fa187cc2b4149a071e77ee9f3a45
m_Pitch: 1af3136670aece3419669e966058f72f
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 3705997264899357636}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &1928862306469247254
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 416a3b5c8c21a954b84a41f15a72ed51
m_EffectName: Attenuation
m_MixLevel: 13a2ed3d53628044daade4ea1ce9a01d
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &3581666672454972537
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 911a860d63d95184dba352be20e7aa70
m_EffectName: Attenuation
m_MixLevel: 0ac97cd1e1e69a848afc443504c6972a
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &3705997264899357636
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: ee37a0386013f8f4ba2dad6353996bc5
m_EffectName: Attenuation
m_MixLevel: 0cf2b5dd63c3f56419bf06fba4cd7fdf
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 032de345950918c4e89684078c6a7213
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eccabbfccff5dd643a2f4ab95956d0b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 89be129a0b3b303478d411ad4ec84e30, type: 3}
m_Name: Stick Burn Quality
m_EditorClassIdentifier:
FuelValue: 10
BurningSound: {fileID: 0}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 273b9cf97d0c80e449f24a33a2d261d1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3482130534745816337
--- !u!1 &5145448032959125661
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -8,46 +8,46 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 409532536335014064}
- component: {fileID: 2366637036822799078}
- component: {fileID: 7411394856680257321}
- component: {fileID: 5008951219788601564}
m_Layer: 0
m_Name: Cube
- component: {fileID: 3101902165573212776}
- component: {fileID: 5080344277934357577}
- component: {fileID: 8966079174287621822}
- component: {fileID: 2134983512241497966}
m_Layer: 10
m_Name: Cylinder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &409532536335014064
--- !u!4 &3101902165573212776
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3482130534745816337}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_GameObject: {fileID: 5145448032959125661}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.7, y: 0.15, z: 0.15}
m_LocalScale: {x: 0.1, y: 0.2, z: 0.1}
m_Children: []
m_Father: {fileID: 9177655811231306216}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!33 &2366637036822799078
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!33 &5080344277934357577
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3482130534745816337}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7411394856680257321
m_GameObject: {fileID: 5145448032959125661}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &8966079174287621822
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3482130534745816337}
m_GameObject: {fileID: 5145448032959125661}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
@ -59,7 +59,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 80996928df7a0d847bbb7a283c52976b, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -80,19 +80,19 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &5008951219788601564
--- !u!65 &2134983512241497966
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3482130534745816337}
m_GameObject: {fileID: 5145448032959125661}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
m_Size: {x: 1.0000001, y: 2.0000005, z: 1.0000005}
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940699}
--- !u!1 &9177655811231306215
GameObject:
m_ObjectHideFlags: 0
@ -104,6 +104,7 @@ GameObject:
- component: {fileID: 9177655811231306216}
- component: {fileID: 456025085184268836}
- component: {fileID: 8167482766655706823}
- component: {fileID: 2107507585819105735}
m_Layer: 0
m_Name: Stick
m_TagString: Untagged
@ -122,7 +123,7 @@ Transform:
m_LocalPosition: {x: 2.296, y: 2, z: 0.147}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 409532536335014064}
- {fileID: 3101902165573212776}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -155,3 +156,16 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Grabbed: 0
--- !u!114 &2107507585819105735
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9177655811231306215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b647d1ea5d6785a4d8e6f6b2208e5f1c, type: 3}
m_Name:
m_EditorClassIdentifier:
Quality: {fileID: 11400000, guid: 273b9cf97d0c80e449f24a33a2d261d1, type: 2}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,104 +0,0 @@
fileFormatVersion: 2
guid: cbe9964f930fcb64983ae1cf44fd4bce
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 1
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 3
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Win
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 2
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -180,8 +180,8 @@ MonoBehaviour:
overrideState: 0
value: 0
postExposure:
overrideState: 1
value: -1
overrideState: 0
value: 0
contrast:
overrideState: 0
value: 0

View File

@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Unnamed Burn Quality", menuName = "Campfire/Burn Quality")]
public class BurnQuality : ScriptableObject {
public float FuelValue;
public AudioClip BurningSound;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 89be129a0b3b303478d411ad4ec84e30
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Burnable : MonoBehaviour {
public BurnQuality Quality;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b647d1ea5d6785a4d8e6f6b2208e5f1c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Campfire : MonoBehaviour {
public Light DynamicLight;
[Tooltip("This audiosource will play the clips to indicate that an object has been thrown in the fire.")]
public AudioSource BurnEffectSource;
public float GoodFuelAmount;
[Tooltip("The light turns this color when Fuel < GoodFuelAmount. Otherwise it'll be as it is in the editor.")]
public Color TooLowFuelColor;
public float RandomVarianceDuration;
public float RandomVarianceMagnitude;
[Header("Runtime values")]
public float Fuel;
private Color EnoughFuelColor;
private float FullRange;
private float RandomVariance = 0;
private float NextRandomVariance = 0;
private float LastRandomVarianceChange = 0;
private void Awake() {
EnoughFuelColor = DynamicLight.color;
FullRange = DynamicLight.range;
}
private void Update() {
if (Time.time - LastRandomVarianceChange > RandomVarianceDuration) {
NextRandomVariance = (Random.value - 0.5f) * 2f * RandomVarianceMagnitude;
LastRandomVarianceChange = Time.time;
}
RandomVariance = Mathf.Lerp(RandomVariance, NextRandomVariance, (Time.time - LastRandomVarianceChange) / RandomVarianceDuration);
Fuel -= Time.deltaTime;
DynamicLight.range = Mathf.Log(Fuel + 2f, 10) / 2f * FullRange + RandomVariance;
DynamicLight.color = Color.Lerp(DynamicLight.color, Fuel < GoodFuelAmount ? TooLowFuelColor : EnoughFuelColor, 10f * Time.deltaTime);
}
private void OnCollisionEnter(Collision c) {
if (c.collider.attachedRigidbody != null && c.collider.attachedRigidbody) {
Burnable Burnable = c.collider.attachedRigidbody.GetComponent<Burnable>();
if (Burnable != null) {
Fuel += Burnable.Quality.FuelValue;
BurnEffectSource.PlayOneShot(Burnable.Quality.BurningSound);
Destroy(c.collider.attachedRigidbody.gameObject);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d53e1b3547ca29043b4a527f784da518
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 100
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,6 +9,8 @@ public class Item : MonoBehaviour {
private Rigidbody Body;
private Transform World;
private bool BeingPlaced = false;
private Vector3 TargetPosition;
private void Awake() {
Body = GetComponent<Rigidbody>();
@ -18,7 +20,17 @@ public class Item : MonoBehaviour {
private void Update() {
if (Grabbed) {
transform.localPosition = Vector3.Lerp(transform.localPosition, Vector3.zero, 10f * Time.deltaTime);
transform.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.identity, 10f * Time.deltaTime);
} else if (BeingPlaced) {
// Lerp to TargetPosition, then continue simulation
Vector3 Delta = TargetPosition - transform.position;
float Diff = Delta.magnitude;
if (Diff < 0.1f) {
transform.position = TargetPosition;
Body.isKinematic = false;
BeingPlaced = false;
} else {
transform.position = Vector3.Lerp(transform.position, TargetPosition, 20f * Time.deltaTime);
}
}
}
@ -28,10 +40,10 @@ public class Item : MonoBehaviour {
Grabbed = true;
}
public void Drop(Vector3 throwVector) {
public void Drop(Vector3 where) {
transform.parent = World;
Body.isKinematic = false;
Body.AddForce(throwVector, ForceMode.VelocityChange);
TargetPosition = where;
BeingPlaced = true;
Grabbed = false;
}
}

View File

@ -1,11 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ItemGrabber : MonoBehaviour {
public Transform CameraTransform;
public Transform HandTransform;
public CanvasGroup GrabHint;
public Text GrabText;
public LayerMask ItemLayer;
public float Distance;
public float ThrowVelocity;
@ -17,6 +19,9 @@ public class ItemGrabber : MonoBehaviour {
if (GrabHint == null) {
Debug.LogWarning("Player's GrabHint is not set, and pick ups will not be indicated.");
}
if (GrabText == null) {
Debug.LogWarning("Player's GrabText is not set, and pick up texts will not necessarily match the object.");
}
}
private void Update() {
@ -25,6 +30,7 @@ public class ItemGrabber : MonoBehaviour {
Vector3 From = CameraTransform.position;
Vector3 Direction = CameraTransform.forward;
if (GrabbedItem == null) {
Debug.DrawLine(From, From + Direction * Distance, Color.red);
if (Physics.Raycast(From, Direction, out Hit, Distance, ItemLayer) &&
Hit.collider.attachedRigidbody != null) {
Item = Hit.collider.attachedRigidbody.GetComponent<Item>();
@ -35,17 +41,21 @@ public class ItemGrabber : MonoBehaviour {
GrabbedItem = Item;
}
} else if (Input.GetButtonDown("Grab")) {
Vector3 Forward = CameraTransform.forward;
if (Physics.Raycast(From, Direction, out Hit, 10f)) {
// Throw direction should be where we're pointign, but slightly upwards
Forward = (Hit.point - From).normalized + Vector3.up;
Vector3 DropPosition;
if (Physics.Raycast(From, Direction, out Hit, Distance * 2f)) {
DropPosition = Hit.point + Hit.normal * 0.1f;
} else {
DropPosition = From + Direction * Distance;
}
GrabbedItem.Drop(Forward * ThrowVelocity);
GrabbedItem.Drop(DropPosition);
GrabbedItem = null;
}
if (GrabHint != null) {
GrabHint.alpha = Mathf.Lerp(GrabHint.alpha, Item != null ? 1 : 0, 10f * Time.deltaTime);
}
if (Item != null && GrabText != null) {
GrabText.text = $"Take {Item.name}";
}
}
}

View File

@ -84,7 +84,7 @@ Material:
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Exposure: 0.6
- _Exposure: 0.5
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1