Compare commits
3 Commits
0063735802
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f4642ea005 | |||
| d8295719b0 | |||
| fc78d599a8 |
@@ -439,6 +439,7 @@ GameObject:
|
||||
- component: {fileID: 4444498079052879519}
|
||||
- component: {fileID: 5173819118098093347}
|
||||
- component: {fileID: 1410439939888368689}
|
||||
- component: {fileID: 4848130177960439240}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
@@ -574,3 +575,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::SoundSettingManager
|
||||
audioMixer: {fileID: 24100000, guid: 3490106d3e6edc143b9179d3107780dd, type: 2}
|
||||
--- !u!114 &4848130177960439240
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8685480739473632986}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f2dcea982e135f3448df561481c5fea7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::ItemInstantiationManager
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,117 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 712d8c367ec686148b06ed141781d8e0
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
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: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9d7b358ebaf9a647be2309f7843ae3f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -66,7 +66,7 @@ MeshRenderer:
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 5725a4484043ade4b85468649933fdcc, type: 2}
|
||||
- {fileID: 2100000, guid: 4d01c458a905b944f8dabc21fb63577e, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
@@ -5035,7 +5035,7 @@ GameObject:
|
||||
- component: {fileID: 5800804362539127280}
|
||||
- component: {fileID: 5158393299614104066}
|
||||
m_Layer: 0
|
||||
m_Name: TestTnt
|
||||
m_Name: ID_DYNAMITE
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea8f36f5e928823469cf3d0ebc62afc7
|
||||
guid: 1e2171f251519db47821162463991c4d
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -929,12 +929,124 @@ Transform:
|
||||
m_GameObject: {fileID: 872867677}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 4.16614, y: 2.051, z: 0.82164}
|
||||
m_LocalPosition: {x: 14.454, y: 35.412, z: 4.411}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1757155171}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &907193628
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 907193632}
|
||||
- component: {fileID: 907193631}
|
||||
- component: {fileID: 907193630}
|
||||
- component: {fileID: 907193629}
|
||||
m_Layer: 6
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!65 &907193629
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 907193628}
|
||||
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_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &907193630
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 907193628}
|
||||
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: 78be8f8bd251f244ab82d30f189c8824, 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!33 &907193631
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 907193628}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &907193632
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 907193628}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 14.41, y: 36.27, z: -1.91}
|
||||
m_LocalScale: {x: 6.073, y: 5.7034, z: 0.72736}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1073270999
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1028,7 +1140,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1235880153}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -22.93, y: -16.57, z: -49.807}
|
||||
m_LocalPosition: {x: -69.6, y: 5.947, z: -49.807}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -1065,13 +1177,61 @@ PrefabInstance:
|
||||
propertyPath: rotationSpeed
|
||||
value: 40
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5056434560497563343, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 2.41278
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: maxDistance
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: rotationSpeed
|
||||
value: 1000
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: targetOffset.y
|
||||
value: 0.15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: collisionOffset
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: collisionRadius
|
||||
value: 0.01
|
||||
value: 0.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: collisionLayers.m_Bits
|
||||
value: 8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: obstructionMask.m_Bits
|
||||
value: 64
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1113,6 +1273,18 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6872729306491234319, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6872729306491234319, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6872729306491234319, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8111368525007731252, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_Height
|
||||
value: 2.67
|
||||
@@ -11198,3 +11370,4 @@ SceneRoots:
|
||||
- {fileID: 273139142}
|
||||
- {fileID: 1073270999}
|
||||
- {fileID: 2107450398}
|
||||
- {fileID: 907193632}
|
||||
|
||||
@@ -35,18 +35,26 @@ private void Update()
|
||||
}
|
||||
}
|
||||
|
||||
// we'll set this up to only try to add one item to the inventory at a time for now
|
||||
// there won't be stacked items in the wild for right now
|
||||
public bool AddItem(Item item, int quantity)
|
||||
{
|
||||
int curQuantity = quantity;
|
||||
|
||||
// first try to stack
|
||||
for (int i = 0; i < itemSlots.Length; i++)
|
||||
{
|
||||
if (itemSlots[i].item == item.id && itemSlots[i].quantity < item.maxStack)
|
||||
if (itemSlots[i].item == item.id && itemSlots[i].quantity + quantity < item.maxStack)
|
||||
{
|
||||
itemSlots[i].quantity += 1;
|
||||
return true;
|
||||
}
|
||||
else if (itemSlots[i].item == item.id)
|
||||
{
|
||||
curQuantity = quantity - (item.maxStack - itemSlots[i].quantity);
|
||||
itemSlots[i].quantity = item.maxStack;
|
||||
|
||||
if (curQuantity <= 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// no stack to add to, try to find an empty slot
|
||||
@@ -56,7 +64,7 @@ public bool AddItem(Item item, int quantity)
|
||||
{
|
||||
itemSlots[i] = new ItemSlot();
|
||||
|
||||
itemSlots[i].quantity = 1;
|
||||
itemSlots[i].quantity = curQuantity;
|
||||
itemSlots[i].item = item.id;
|
||||
return true;
|
||||
}
|
||||
@@ -88,6 +96,7 @@ public bool RemoveItemQuantity(ItemIdEnum itemId, int quantity)
|
||||
// we have exactly enough in the current slot, so nullify it and
|
||||
// exit
|
||||
itemSlots[i].item = ItemIdEnum.NONE;
|
||||
itemSlots[i].quantity = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using static Unity.Cinemachine.CinemachineTargetGroup;
|
||||
@@ -8,38 +9,35 @@
|
||||
|
||||
public class CameraController : MonoBehaviour
|
||||
{
|
||||
public float camTargetRotation { get; private set; } = 0;
|
||||
public CameraControlMode CamControlMode { get; private set; } = CameraControlMode.SnapRotate;
|
||||
[Header("Target")]
|
||||
[SerializeField] private Transform target;
|
||||
[SerializeField] private Vector3 targetOffset = new Vector3(0f, 1.5f, 0f);
|
||||
public Camera MainCamera;
|
||||
public Transform playerCamHome;
|
||||
|
||||
private bool isCamRotating = false;
|
||||
|
||||
[Header("Rotation")]
|
||||
public float mouseSensitivity = 200f;
|
||||
public float minPitch = -30f;
|
||||
public float maxPitch = 60f;
|
||||
public float distance = 5f;
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
[Header("Orbit")]
|
||||
[SerializeField] private float distance = 5f;
|
||||
[SerializeField] private float minDistance = 1f;
|
||||
[SerializeField] private float maxDistance = 8f;
|
||||
[SerializeField] private float rotationSpeed = 180f;
|
||||
[SerializeField] private float rotationOffset = 270f;
|
||||
[SerializeField] private float minPitch = -30f;
|
||||
[SerializeField] private float maxPitch = 75f;
|
||||
|
||||
[Header("Zoom")]
|
||||
public float followSpeed = 10f;
|
||||
public float maxDistance = 6f;
|
||||
public float minDistance = 1f;
|
||||
public float zoomSpeed = 5f;
|
||||
public float heightOffset = -0.5f;
|
||||
private float currentDistance;
|
||||
private float distanceVelocity;
|
||||
[SerializeField] private float zoomSpeed = 2f;
|
||||
[SerializeField] private float zoomSmoothness = 10f;
|
||||
|
||||
[Header("Collision")]
|
||||
public float collisionRadius = 0.3f;
|
||||
public float collisionOffset = 0.2f;
|
||||
public LayerMask collisionMask;
|
||||
[Header("Camera Collision")]
|
||||
[SerializeField] private LayerMask collisionLayers;
|
||||
[SerializeField] private float collisionRadius = 0.25f;
|
||||
[SerializeField] private float collisionOffset = 0.1f;
|
||||
[SerializeField] private float positionSmoothness = 15f;
|
||||
|
||||
[Header("Occlusion Settings")]
|
||||
public LayerMask obstructionMask;
|
||||
public float fadedAlpha = 0.25f;
|
||||
public float fadeSpeed = 5f;
|
||||
[SerializeField] private LayerMask obstructionMask;
|
||||
[SerializeField] private float fadedAlpha = 0.25f;
|
||||
[SerializeField] private float fadeSpeed = 5f;
|
||||
|
||||
private Dictionary<Renderer, float> currentAlpha =
|
||||
new Dictionary<Renderer, float>();
|
||||
@@ -47,228 +45,119 @@ public class CameraController : MonoBehaviour
|
||||
private Dictionary<Renderer, float> targetAlpha =
|
||||
new Dictionary<Renderer, float>();
|
||||
|
||||
public Transform playerCamHome;
|
||||
Transform dougBody;
|
||||
private float yaw;
|
||||
private float pitch = 20f;
|
||||
private float targetDistance;
|
||||
private Vector3 currentVelocity;
|
||||
|
||||
private void Update()
|
||||
public Vector3 Forward
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector3 forward = MainCamera.transform.forward;
|
||||
forward.y = 0f;
|
||||
return forward.normalized;
|
||||
}
|
||||
}
|
||||
public Vector3 Right
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector3 right = MainCamera.transform.right;
|
||||
right.y = 0f;
|
||||
return right.normalized;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
targetDistance = distance;
|
||||
|
||||
Vector3 startingAngles = MainCamera.transform.eulerAngles;
|
||||
yaw = startingAngles.y + rotationOffset;
|
||||
pitch = startingAngles.x;
|
||||
|
||||
if (pitch > 180f)
|
||||
{
|
||||
pitch -= 360f;
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
target = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateOcclusion();
|
||||
UpdateFade();
|
||||
|
||||
if (Input.GetMouseButton(1))
|
||||
{
|
||||
HandleFreeCamRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
CamAvoidCollisions();
|
||||
}
|
||||
HandleRotation();
|
||||
HandleZoom();
|
||||
UpdateCameraPosition();
|
||||
}
|
||||
|
||||
void Start()
|
||||
private void HandleRotation()
|
||||
{
|
||||
Vector3 angles = playerCamHome.transform.eulerAngles;
|
||||
|
||||
yaw = angles.y;
|
||||
pitch = angles.x;
|
||||
currentDistance = distance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger cam rotation
|
||||
/// </summary>
|
||||
public void RotateCam()
|
||||
{
|
||||
if (!isCamRotating)
|
||||
if (!Input.GetMouseButton(1))
|
||||
{
|
||||
float currentY = playerCamHome.transform.rotation.eulerAngles.y;
|
||||
camTargetRotation = currentY + 90f;
|
||||
isCamRotating = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set cam rotation immediately
|
||||
/// </summary>
|
||||
void SnapToRotation(float rotation)
|
||||
{
|
||||
if (CamControlMode == CameraControlMode.SnapRotate)
|
||||
{
|
||||
playerCamHome.RotateAround(
|
||||
transform.position,
|
||||
Vector3.up,
|
||||
rotation
|
||||
);
|
||||
|
||||
camTargetRotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move cam to desired rotation (every frame)
|
||||
/// </summary>
|
||||
void HandleSnapCamRotation()
|
||||
{
|
||||
float currentY = playerCamHome.transform.rotation.eulerAngles.y;
|
||||
float step = 200 * Time.deltaTime;
|
||||
float newY = Mathf.MoveTowardsAngle(currentY, camTargetRotation, step);
|
||||
|
||||
playerCamHome.RotateAround(
|
||||
transform.position,
|
||||
Vector3.up,
|
||||
newY - currentY
|
||||
);
|
||||
|
||||
if (Mathf.Abs(Mathf.DeltaAngle(newY, camTargetRotation)) < 0.01f)
|
||||
{
|
||||
isCamRotating = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move cam to desired free rotation (every frame)
|
||||
/// </summary>
|
||||
void HandleFreeCamRotation()
|
||||
{
|
||||
if (dougBody == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
UnityEngine.Cursor.visible = true;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.None;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 target = new Vector3(dougBody.position.x, dougBody.position.y + heightOffset, dougBody.position.z);
|
||||
UnityEngine.Cursor.visible = false;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
// Mouse Input
|
||||
float mouseX = Input.GetAxis("Mouse X");
|
||||
float mouseY = Input.GetAxis("Mouse Y");
|
||||
|
||||
yaw += mouseX * mouseSensitivity * Time.deltaTime;
|
||||
pitch -= mouseY * mouseSensitivity * Time.deltaTime;
|
||||
yaw += Input.GetAxis("Mouse X") * rotationSpeed * Time.deltaTime;
|
||||
pitch -= Input.GetAxis("Mouse Y") * rotationSpeed * Time.deltaTime;
|
||||
|
||||
pitch = Mathf.Clamp(pitch, minPitch, maxPitch);
|
||||
|
||||
// Rotation
|
||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||
|
||||
// Zoom
|
||||
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
||||
|
||||
if (Mathf.Abs(scroll) > 0.0001f)
|
||||
{
|
||||
distance -= scroll * zoomSpeed;
|
||||
distance = Mathf.Clamp(distance, minDistance, maxDistance);
|
||||
}
|
||||
|
||||
currentDistance = Mathf.SmoothDamp(
|
||||
currentDistance,
|
||||
distance,
|
||||
ref distanceVelocity,
|
||||
0.05f);
|
||||
|
||||
float adjustedDistance = currentDistance;
|
||||
|
||||
Vector3 desiredDirection =
|
||||
rotation * Vector3.back;
|
||||
|
||||
// Camera obstruction handling
|
||||
if (Physics.SphereCast(
|
||||
target,
|
||||
collisionRadius,
|
||||
desiredDirection,
|
||||
out RaycastHit hit,
|
||||
currentDistance,
|
||||
collisionMask,
|
||||
QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
adjustedDistance =
|
||||
Mathf.Max(
|
||||
hit.distance - collisionOffset,
|
||||
minDistance);
|
||||
}
|
||||
|
||||
// Desired Position
|
||||
Vector3 offset = rotation * Vector3.forward * -adjustedDistance;
|
||||
Vector3 desiredPosition = target + offset;
|
||||
|
||||
if (desiredPosition.y < dougBody.position.y)
|
||||
{
|
||||
desiredPosition.y = dougBody.position.y;
|
||||
}
|
||||
|
||||
// Smooth Follow
|
||||
playerCamHome.transform.position = Vector3.Lerp(
|
||||
playerCamHome.transform.position,
|
||||
desiredPosition,
|
||||
followSpeed * Time.deltaTime
|
||||
);
|
||||
|
||||
// Look at player
|
||||
playerCamHome.transform.LookAt(target + Vector3.up);
|
||||
}
|
||||
|
||||
void CamAvoidCollisions()
|
||||
private void HandleZoom()
|
||||
{
|
||||
if (dougBody == null)
|
||||
if (!Input.GetMouseButton(1))
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 target = new Vector3(dougBody.position.x, dougBody.position.y + heightOffset, dougBody.position.z);
|
||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||
Vector3 desiredDirection = rotation * Vector3.back;
|
||||
float scrollInput = Input.GetAxis("Mouse ScrollWheel");
|
||||
|
||||
float adjustedDistance = currentDistance;
|
||||
targetDistance -= scrollInput * zoomSpeed;
|
||||
targetDistance = Mathf.Clamp(targetDistance, minDistance, maxDistance);
|
||||
|
||||
if (Physics.SphereCast(
|
||||
target,
|
||||
collisionRadius,
|
||||
desiredDirection,
|
||||
out RaycastHit hit,
|
||||
currentDistance,
|
||||
collisionMask,
|
||||
QueryTriggerInteraction.Ignore))
|
||||
distance = Mathf.Lerp(distance, targetDistance, zoomSmoothness * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void UpdateCameraPosition()
|
||||
{
|
||||
Vector3 targetPosition = target.position + targetOffset;
|
||||
|
||||
Quaternion orbitRotation = Quaternion.Euler(pitch, yaw, 0f);
|
||||
|
||||
Vector3 desiredDirection = orbitRotation * Vector3.back;
|
||||
Vector3 desiredPosition = targetPosition + desiredDirection * distance;
|
||||
|
||||
float correctedDistance = distance;
|
||||
|
||||
if (Physics.SphereCast(targetPosition, collisionRadius, desiredDirection, out RaycastHit hit, distance, collisionLayers, QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
adjustedDistance =
|
||||
Mathf.Max(
|
||||
hit.distance - collisionOffset,
|
||||
minDistance);
|
||||
correctedDistance = Mathf.Max(minDistance, hit.distance - collisionOffset);
|
||||
}
|
||||
|
||||
// Desired Position
|
||||
Vector3 offset = rotation * Vector3.forward * -adjustedDistance;
|
||||
Vector3 desiredPosition = target + offset;
|
||||
Vector3 finalPosition = targetPosition + desiredDirection * correctedDistance;
|
||||
|
||||
if (desiredPosition.y < dougBody.position.y)
|
||||
{
|
||||
desiredPosition.y = dougBody.position.y;
|
||||
}
|
||||
MainCamera.transform.position = Vector3.SmoothDamp(MainCamera.transform.position, finalPosition, ref currentVelocity, 1f / positionSmoothness);
|
||||
|
||||
// Smooth Follow
|
||||
playerCamHome.transform.position = Vector3.Lerp(
|
||||
playerCamHome.transform.position,
|
||||
desiredPosition,
|
||||
followSpeed * Time.deltaTime
|
||||
);
|
||||
|
||||
// Look at player
|
||||
playerCamHome.transform.LookAt(target + Vector3.up);
|
||||
MainCamera.transform.rotation = Quaternion.LookRotation(targetPosition - MainCamera.transform.position, Vector3.up);
|
||||
}
|
||||
|
||||
void UpdateOcclusion()
|
||||
{
|
||||
if (dougBody == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset all renderers to visible
|
||||
foreach (Renderer r in new List<Renderer>(targetAlpha.Keys))
|
||||
{
|
||||
@@ -276,12 +165,12 @@ void UpdateOcclusion()
|
||||
}
|
||||
|
||||
Vector3 dir =
|
||||
MainCamera.transform.position - dougBody.position;
|
||||
MainCamera.transform.position - target.position;
|
||||
|
||||
float dist = dir.magnitude;
|
||||
|
||||
RaycastHit[] hits = Physics.RaycastAll(
|
||||
dougBody.position,
|
||||
target.position,
|
||||
dir.normalized,
|
||||
dist,
|
||||
obstructionMask,
|
||||
|
||||
@@ -17,6 +17,7 @@ public class GameManager : MonoBehaviour
|
||||
public MenuController MenuController { get; private set; }
|
||||
public SoundSettingManager SoundSettingManager { get; private set; }
|
||||
public PlayerController PlayerController { get; private set; }
|
||||
public ItemInstantiationManager ItemInstantiationManager { get; private set; }
|
||||
public Image BlackScreen { get; private set; }
|
||||
|
||||
// Are we currently in a scene transition?
|
||||
@@ -59,6 +60,7 @@ private void ReloadReferences()
|
||||
Instance.Inventory = GetComponent<Inventory>();
|
||||
Instance.TimeManager = GetComponent<TimeManager>();
|
||||
Instance.PlayerManager = GetComponent<PlayerManager>();
|
||||
Instance.ItemInstantiationManager = GetComponent<ItemInstantiationManager>();
|
||||
|
||||
Instance.SoundSettingManager = GetComponent<SoundSettingManager>();
|
||||
Instance.SoundSettingManager.ReloadReferences();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ItemInstantiationManager : MonoBehaviour
|
||||
{
|
||||
private Dictionary<ItemIdEnum, GameObject> spawnablePrefabs = new Dictionary<ItemIdEnum, GameObject>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
LoadSpawnablePrefabs();
|
||||
}
|
||||
|
||||
private void LoadSpawnablePrefabs()
|
||||
{
|
||||
foreach (ItemIdEnum itemId in Enum.GetValues(typeof(ItemIdEnum)))
|
||||
{
|
||||
Item item = ItemUtilities.GetItemFromId(itemId);
|
||||
|
||||
if (item.throwable)
|
||||
{
|
||||
GameObject prefab = Resources.Load<GameObject>($"SpawnablePrefabs/ID_{itemId.ToString()}");
|
||||
if (prefab != null)
|
||||
{
|
||||
spawnablePrefabs.Add(itemId, prefab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetThrowablePrefab(ItemIdEnum itemId)
|
||||
{
|
||||
return spawnablePrefabs[itemId];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2dcea982e135f3448df561481c5fea7
|
||||
@@ -149,17 +149,9 @@ void ApplyWalk()
|
||||
verticalMovement = Input.GetAxisRaw("Vertical");
|
||||
horizontalMovement = Input.GetAxisRaw("Horizontal");
|
||||
}
|
||||
Vector3 input = Vector3.ClampMagnitude(new Vector3(horizontalMovement, 0f, verticalMovement), 1f);
|
||||
|
||||
moveDir = new Vector3(horizontalMovement, 0, verticalMovement).normalized;
|
||||
|
||||
if (cameraController != null)
|
||||
{
|
||||
// re-matrix the rotation direction so movement is consistent no matter what
|
||||
// the camera rotation is
|
||||
|
||||
Matrix4x4 matrix = Matrix4x4.Rotate(Quaternion.Euler(0, cameraController.playerCamHome.rotation.eulerAngles.y, 0));
|
||||
moveDir = matrix.MultiplyPoint3x4(moveDir);
|
||||
}
|
||||
moveDir = cameraController.Forward * input.z + cameraController.Right * input.x;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -244,44 +236,58 @@ void RotatePlayerTowardMouse()
|
||||
}
|
||||
}*/
|
||||
|
||||
Camera cam = cameraController.MainCamera;
|
||||
|
||||
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
Vector3 targetPoint;
|
||||
|
||||
// 1. Try real world hit first (most stable)
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, 1000f))
|
||||
// When rotating the cam with right mouse, look forward
|
||||
if (Input.GetMouseButton(1))
|
||||
{
|
||||
targetPoint = hit.point;
|
||||
Quaternion targetRotation = Quaternion.LookRotation(cameraController.Forward);
|
||||
|
||||
DougBody.transform.rotation = Quaternion.Slerp(
|
||||
DougBody.transform.rotation,
|
||||
targetRotation,
|
||||
rotationSpeed * Time.deltaTime
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. Fallback to plane at player height
|
||||
Plane plane = new Plane(Vector3.up, DougBody.transform.position);
|
||||
Camera cam = cameraController.MainCamera;
|
||||
|
||||
if (!plane.Raycast(ray, out float enter))
|
||||
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
Vector3 targetPoint;
|
||||
|
||||
// Try real world hit first (most stable), ignoring Dither layer
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, 1000f, ~LayerMask.GetMask("Dither")))
|
||||
{
|
||||
targetPoint = hit.point;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback to plane at player height
|
||||
Plane plane = new Plane(Vector3.up, DougBody.transform.position);
|
||||
|
||||
if (!plane.Raycast(ray, out float enter))
|
||||
return;
|
||||
|
||||
targetPoint = ray.GetPoint(enter);
|
||||
}
|
||||
|
||||
// 3. Flatten direction so we only rotate on Y axis
|
||||
Vector3 direction = targetPoint - DougBody.transform.position;
|
||||
direction.y = 0f;
|
||||
|
||||
if (direction.sqrMagnitude < 0.001f)
|
||||
return;
|
||||
|
||||
targetPoint = ray.GetPoint(enter);
|
||||
// 4. Convert to rotation
|
||||
Quaternion targetRotation = Quaternion.LookRotation(direction.normalized);
|
||||
|
||||
// 5. Smooth rotation
|
||||
DougBody.transform.rotation = Quaternion.Slerp(
|
||||
DougBody.transform.rotation,
|
||||
targetRotation,
|
||||
rotationSpeed * Time.deltaTime
|
||||
);
|
||||
}
|
||||
|
||||
// 3. Flatten direction so we only rotate on Y axis
|
||||
Vector3 direction = targetPoint - DougBody.transform.position;
|
||||
direction.y = 0f;
|
||||
|
||||
if (direction.sqrMagnitude < 0.001f)
|
||||
return;
|
||||
|
||||
// 4. Convert to rotation
|
||||
Quaternion targetRotation = Quaternion.LookRotation(direction.normalized);
|
||||
|
||||
// 5. Smooth rotation
|
||||
DougBody.transform.rotation = Quaternion.Slerp(
|
||||
DougBody.transform.rotation,
|
||||
targetRotation,
|
||||
rotationSpeed * Time.deltaTime
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,7 +8,8 @@ public class ThrowableHand : Tool
|
||||
public float range;
|
||||
public float forceModifier;
|
||||
public float loft;
|
||||
public GameObject testBomb;
|
||||
public ItemIdEnum activeThrowable;
|
||||
private int activeThrowableIndex;
|
||||
|
||||
// Mathematical plane used to catch the raycast from camera to get direction for
|
||||
// looking at the mouse
|
||||
@@ -89,20 +90,64 @@ private void DrawTargetProjection()
|
||||
targetProjection.transform.position = finalPosition;
|
||||
}
|
||||
|
||||
private ItemIdEnum GetNextThrowable()
|
||||
{
|
||||
// Use active throwable index to let us continue to search for throwables
|
||||
if (activeThrowableIndex >= GameManager.Instance.Inventory.itemSlots.Length)
|
||||
activeThrowableIndex = 0;
|
||||
|
||||
// Search starting at throwable index
|
||||
for (int i = activeThrowableIndex; i < GameManager.Instance.Inventory.itemSlots.Length; i++)
|
||||
{
|
||||
if (ItemUtilities.GetItemFromId(GameManager.Instance.Inventory.itemSlots[i].item).throwable)
|
||||
{
|
||||
activeThrowableIndex = i;
|
||||
return GameManager.Instance.Inventory.itemSlots[i].item;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap back around to 0 if we didn't find anything
|
||||
for (int i = 0; i < activeThrowableIndex; i++)
|
||||
{
|
||||
if (ItemUtilities.GetItemFromId(GameManager.Instance.Inventory.itemSlots[i].item).throwable)
|
||||
{
|
||||
activeThrowableIndex = i;
|
||||
return GameManager.Instance.Inventory.itemSlots[i].item;
|
||||
}
|
||||
}
|
||||
|
||||
// We have no throwable items...
|
||||
activeThrowableIndex = 0;
|
||||
return ItemIdEnum.NONE;
|
||||
}
|
||||
|
||||
public override void Use()
|
||||
{
|
||||
GameObject newBomb = Instantiate(testBomb);
|
||||
newBomb.transform.position = transform.position;
|
||||
if (activeThrowable == ItemIdEnum.NONE)
|
||||
{
|
||||
activeThrowable = GetNextThrowable();
|
||||
}
|
||||
|
||||
Vector3 direction = transform.forward * throwForce * forceModifier;
|
||||
direction += GameManager.Instance.PlayerController.GetVelocity();
|
||||
direction.y = loft;
|
||||
if (activeThrowable != ItemIdEnum.NONE && GameManager.Instance.Inventory.GetItemQuantity(activeThrowable) > 0)
|
||||
{
|
||||
GameObject throwable = Instantiate(GameManager.Instance.ItemInstantiationManager.GetThrowablePrefab(activeThrowable));
|
||||
|
||||
newBomb.GetComponent<Rigidbody>().AddForce(direction, ForceMode.Impulse);
|
||||
if (throwable != null)
|
||||
{
|
||||
throwable.transform.position = transform.position;
|
||||
|
||||
Vector3 direction = transform.forward * throwForce * forceModifier;
|
||||
direction += GameManager.Instance.PlayerController.GetVelocity();
|
||||
direction.y = loft;
|
||||
|
||||
throwable.GetComponent<Rigidbody>().AddForce(direction, ForceMode.Impulse);
|
||||
GameManager.Instance.Inventory.RemoveItemQuantity(activeThrowable, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void UseAlt()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
activeThrowable = GetNextThrowable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,16 @@ public class Item
|
||||
public int maxStack = 10;
|
||||
public string description = "";
|
||||
public string itemImagePath = "";
|
||||
public bool throwable = false;
|
||||
|
||||
public Item(string itemName, ItemIdEnum id, int maxStack, string description, string itemImagePath)
|
||||
public Item(string itemName, ItemIdEnum id, int maxStack, string description, string itemImagePath, bool throwable = false)
|
||||
{
|
||||
this.itemName = itemName;
|
||||
this.id = id;
|
||||
this.maxStack = maxStack;
|
||||
this.description = description;
|
||||
this.itemImagePath = itemImagePath;
|
||||
this.throwable = throwable;
|
||||
}
|
||||
|
||||
public Item(ItemIdEnum id)
|
||||
@@ -28,15 +30,18 @@ public Item(ItemIdEnum id)
|
||||
this.maxStack = newItem.maxStack;
|
||||
this.description = newItem.description;
|
||||
this.itemImagePath= newItem.itemImagePath;
|
||||
this.throwable = newItem.throwable;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ItemIdEnum
|
||||
{
|
||||
NONE = 0,
|
||||
STAR_SHARD = 1
|
||||
STAR_SHARD = 1,
|
||||
DYNAMITE = 2
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public static class ItemUtilities
|
||||
{
|
||||
// THIS IS WHERE ALL THE ITEMS ARE DEFINED
|
||||
@@ -50,9 +55,19 @@ public static Item GetItemFromId(ItemIdEnum itemId)
|
||||
id: itemId,
|
||||
maxStack: 10,
|
||||
description: "A rare material that can only be found here in the valley.",
|
||||
itemImagePath: "ItemSprites/starShard");
|
||||
itemImagePath: "ItemSprites/starShard",
|
||||
false);
|
||||
|
||||
case ItemIdEnum.DYNAMITE:
|
||||
return new Item(
|
||||
itemName: "Dynamite",
|
||||
id: itemId,
|
||||
maxStack: 10,
|
||||
description: "A throwable red stick that goes BOOM (after a short time).",
|
||||
itemImagePath: "ItemSprites/dynamite",
|
||||
true);
|
||||
}
|
||||
|
||||
return new Item("", itemId, 0, "", "ItemSprites/noneItem"); ;
|
||||
return new Item("", itemId, 0, "", "ItemSprites/noneItem");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -116,8 +116,8 @@ Material:
|
||||
- _XRMotionVectorsPass: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: tntFuse
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _XRMotionVectorsPass: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1}
|
||||
- _Color: {r: 0.22641507, g: 0.22641507, b: 0.22641507, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &5902119946383194518
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d01c458a905b944f8dabc21fb63577e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -24,7 +24,7 @@ TagManager:
|
||||
- CameraObstructions
|
||||
- Water
|
||||
- UI
|
||||
-
|
||||
- Dither
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user