namespacing and multiplayer lobby

This commit is contained in:
sebastianhampel1 2023-06-01 14:25:46 -04:00
parent 1d4a6319e9
commit 3e1b55b036
37 changed files with 2962 additions and 785 deletions

View File

@ -0,0 +1,268 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6018244971025479954
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TwoSidedCold
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ValidKeywords:
- _DISABLE_SSR_TRANSPARENT
- _DOUBLESIDED_ON
- _NORMALMAP
- _NORMALMAP_TANGENT_SPACE
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 2225
stringTagMap: {}
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CoatMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceThicknessMap:
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}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: e5d7857b4e6de39418d36ee49f68c66c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
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:
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AddPrecomputedVelocity: 0
- _AlbedoAffectEmissive: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaCutoffPostpass: 0.5
- _AlphaCutoffPrepass: 0.5
- _AlphaCutoffShadow: 0.5
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _Anisotropy: 0
- _BlendMode: 0
- _CoatMask: 0
- _CullMode: 0
- _CullModeForward: 0
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DiffusionProfile: 0
- _DiffusionProfileHash: 0
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DoubleSidedEnable: 1
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 1
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EmissiveExposureWeight: 1
- _EmissiveIntensity: 1
- _EmissiveIntensityUnit: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnergyConservingSpecularColor: 1
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMapParametrization: 0
- _HeightMax: 1
- _HeightMin: -1
- _HeightOffset: 0
- _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5
- _InvTilingScale: 1
- _Ior: 1.5
- _IridescenceMask: 1
- _IridescenceThickness: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0.634
- _MetallicRemapMax: 1
- _MetallicRemapMin: 0
- _NormalMapSpace: 0
- _NormalScale: 0.69
- _OpaqueCullMode: 2
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _Smoothness: 0.707
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SpecularOcclusionMode: 1
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _Thickness: 1
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVBase: 0
- _UVDetail: 0
- _UVEmissive: 0
- _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.71132076, g: 0.8888575, b: 1, a: 1}
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.71132076, g: 0.8888575, b: 1, a: 1}
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6510f454e38068c4392825f2f7689ef1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -69,9 +69,9 @@ ModelImporter:
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
normalImportMode: 1
tangentImportMode: 3
normalCalculationMode: 4
normalCalculationMode: 3
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0

BIN
Assets/Models/WorldEnviornment/TwoWindowWalls.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,106 @@
fileFormatVersion: 2
guid: 5554e2a3b56d46d46a640a8d60d3897b
ModelImporter:
serializedVersion: 21300
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 1
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -63,7 +63,7 @@ MeshRenderer:
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6106523363fe51244a25535b75eb736d, type: 2}
- {fileID: -6922793697723135513, guid: c038a760050b2c644a3947a794190aac, type: 3}
- {fileID: 2100000, guid: 6510f454e38068c4392825f2f7689ef1, type: 2}
- {fileID: 2100000, guid: 6106523363fe51244a25535b75eb736d, type: 2}
- {fileID: 2100000, guid: 4f7af3243dccb2443a3b363fb4b73602, type: 2}
- {fileID: -6629797300637803691, guid: c038a760050b2c644a3947a794190aac, type: 3}

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d877ec3e844f2ca46830012e8e79319b, type: 3}
m_Name: PhysicallyBasedSky
m_EditorClassIdentifier:
active: 0
active: 1
rotation:
m_OverrideState: 0
m_Value: 0
@ -207,7 +207,7 @@ MonoBehaviour:
active: 1
skyType:
m_OverrideState: 1
m_Value: 1
m_Value: 4
cloudType:
m_OverrideState: 1
m_Value: 0
@ -342,7 +342,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3}
m_Name: HDRISky
m_EditorClassIdentifier:
active: 1
active: 0
rotation:
m_OverrideState: 0
m_Value: 0

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e0543d9968729644ba772e12b0f7f922
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,226 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5499605880065426175
MonoBehaviour:
m_ObjectHideFlags: 3
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: 953beb541740ddc499d005ee80c9ff29, type: 3}
m_Name: Fog
m_EditorClassIdentifier:
active: 1
quality:
m_OverrideState: 0
m_Value: 1
enabled:
m_OverrideState: 1
m_Value: 1
colorMode:
m_OverrideState: 0
m_Value: 1
color:
m_OverrideState: 0
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
tint:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
maxFogDistance:
m_OverrideState: 0
m_Value: 5000
mipFogMaxMip:
m_OverrideState: 0
m_Value: 0.5
mipFogNear:
m_OverrideState: 0
m_Value: 0
mipFogFar:
m_OverrideState: 0
m_Value: 1000
baseHeight:
m_OverrideState: 1
m_Value: -35.7
maximumHeight:
m_OverrideState: 1
m_Value: 168.9
meanFreePath:
m_OverrideState: 1
m_Value: 21.8
enableVolumetricFog:
m_OverrideState: 1
m_Value: 1
albedo:
m_OverrideState: 1
m_Value: {r: 0.8011926, g: 0.9716981, b: 0.9681743, a: 1}
globalLightProbeDimmer:
m_OverrideState: 0
m_Value: 1
depthExtent:
m_OverrideState: 1
m_Value: 21.3
denoisingMode:
m_OverrideState: 0
m_Value: 2
anisotropy:
m_OverrideState: 0
m_Value: 0
sliceDistributionUniformity:
m_OverrideState: 0
m_Value: 0.75
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
screenResolutionPercentage:
m_OverrideState: 0
m_Value: 12.5
volumeSliceCount:
m_OverrideState: 0
m_Value: 64
m_VolumetricFogBudget:
m_OverrideState: 0
m_Value: 0.33
m_ResolutionDepthRatio:
m_OverrideState: 0
m_Value: 0.666
directionalLightsOnly:
m_OverrideState: 0
m_Value: 0
--- !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: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: VolumeOne Profile
m_EditorClassIdentifier:
components:
- {fileID: 3832449337003281083}
- {fileID: -5499605880065426175}
--- !u!114 &3832449337003281083
MonoBehaviour:
m_ObjectHideFlags: 3
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: 59b6606ef2548734bb6d11b9d160bc7e, type: 3}
m_Name: HDRISky
m_EditorClassIdentifier:
active: 1
rotation:
m_OverrideState: 1
m_Value: 0
skyIntensityMode:
m_OverrideState: 1
m_Value: 0
exposure:
m_OverrideState: 1
m_Value: 0.36
multiplier:
m_OverrideState: 0
m_Value: 1
upperHemisphereLuxValue:
m_OverrideState: 1
m_Value: 0.0191773
upperHemisphereLuxColor:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.43328354, z: 0.44211176}
desiredLuxValue:
m_OverrideState: 0
m_Value: 20000
updateMode:
m_OverrideState: 0
m_Value: 0
updatePeriod:
m_OverrideState: 0
m_Value: 0
includeSunInBaking:
m_OverrideState: 0
m_Value: 0
hdriSky:
m_OverrideState: 1
m_Value: {fileID: 8900000, guid: 1ec218402610c07499cad676b00bd8d7, type: 3}
distortionMode:
m_OverrideState: 0
m_Value: 0
flowmap:
m_OverrideState: 0
m_Value: {fileID: 0}
upperHemisphereOnly:
m_OverrideState: 0
m_Value: 1
scrollOrientation:
m_OverrideState: 0
m_Value:
mode: 1
customValue: 0
additiveValue: 0
multiplyValue: 1
scrollSpeed:
m_OverrideState: 1
m_Value:
mode: 1
customValue: 100
additiveValue: 0
multiplyValue: 1
enableBackplate:
m_OverrideState: 0
m_Value: 0
backplateType:
m_OverrideState: 0
m_Value: 0
groundLevel:
m_OverrideState: 0
m_Value: 0
scale:
m_OverrideState: 0
m_Value: {x: 32, y: 32}
projectionDistance:
m_OverrideState: 0
m_Value: 16
plateRotation:
m_OverrideState: 0
m_Value: 0
plateTexRotation:
m_OverrideState: 0
m_Value: 0
plateTexOffset:
m_OverrideState: 0
m_Value: {x: 0, y: 0}
blendAmount:
m_OverrideState: 0
m_Value: 0
shadowTint:
m_OverrideState: 0
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
pointLightShadow:
m_OverrideState: 0
m_Value: 0
dirLightShadow:
m_OverrideState: 0
m_Value: 0
rectLightShadow:
m_OverrideState: 0
m_Value: 0
m_SkyVersion: 1
enableDistortion:
m_OverrideState: 0
m_Value: 0
procedural:
m_OverrideState: 0
m_Value: 1
scrollDirection:
m_OverrideState: 0
m_Value: 0
m_ObsoleteScrollSpeed:
m_OverrideState: 0
m_Value: 1

View File

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

View File

@ -19,7 +19,7 @@ public class DGemItem : MonoBehaviour
{
if (collision.gameObject.CompareTag("Player"))
{
collision.gameObject.GetComponent<PlayerMovementController>().SetSpeed(decSpeed);
collision.gameObject.GetComponent<Player.PlayerMovementController>().SetSpeed(decSpeed);
Destroy(gameObject);
}
}

View File

@ -1,6 +1,6 @@
using UnityEngine;
using System;
using EnemyAI;
/*
# Enemy System
## States
@ -32,7 +32,7 @@ using EnemyAI;
*/
class AIStateMachine : MonoBehaviour{
[SerializeField]
private EnemyState state;
private EnemyAI.EnemyState state;

View File

@ -2,130 +2,133 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkinlessMonsterAnimator : MonoBehaviour
{
[SerializeField] private Animator animator;
[SerializeField] [Tooltip("This is the object with the skin dissolve material")]
private GameObject modelObject;
[SerializeField] private List<GameObject> objectsThatFallOnDeath = new();
[SerializeField] private float deathSpeed = 5f;
[SerializeField] private float fastDeathduration = 1f;
[SerializeField] private float deathDuration = 5f;
private float curDeathSpeed = 5f;
private Material dissolveMaterial;
private bool isAlive = true;
private float speed;
public bool IsRunning { get; private set; }
// Start is called before the first frame update
private void Start()
namespace Enemy {
public class SkinlessMonsterAnimator : MonoBehaviour
{
dissolveMaterial = modelObject.GetComponent<SkinnedMeshRenderer>().materials[0];
curDeathSpeed = deathSpeed;
}
[SerializeField] private Animator animator;
// Update is called once per frame
private void Update()
{
if (isAlive)
[SerializeField]
[Tooltip("This is the object with the skin dissolve material")]
private GameObject modelObject;
[SerializeField] private List<GameObject> objectsThatFallOnDeath = new();
[SerializeField] private float deathSpeed = 5f;
[SerializeField] private float fastDeathduration = 1f;
[SerializeField] private float deathDuration = 5f;
private float curDeathSpeed = 5f;
private Material dissolveMaterial;
private bool isAlive = true;
private float speed;
public bool IsRunning { get; private set; }
// Start is called before the first frame update
private void Start()
{
animator.SetFloat("Speed", speed);
}
else
{
var quantity = dissolveMaterial.GetFloat("_DissolveQuantity");
quantity = Mathf.Lerp(quantity, -2, Time.deltaTime * curDeathSpeed);
dissolveMaterial.SetFloat("_DissolveQuantity", quantity);
}
}
public void StartMoving()
{
if (isAlive)
{
IsRunning = true;
speed = 1;
}
}
public void StopMoving()
{
if (isAlive)
{
speed = 0;
IsRunning = false;
}
}
public void Attack()
{
if (isAlive) animator.SetTrigger("Attack");
}
/// <summary>
/// 0,1,2,3
/// </summary>
/// <param name="attackType"></param>
public void SetAttackType(int attackType)
{
animator.SetInteger("AttackIndex", attackType);
}
public void InLight()
{
if (isAlive)
animator.SetBool("InLight", true);
}
public void NotInLight()
{
if (isAlive)
animator.SetBool("InLight", false);
}
public void AttackScream()
{
if (isAlive)
animator.SetTrigger("AttackScream");
}
public void Kill(bool fast = false)
{
//animator.speed = 0;
InLight();
isAlive = false;
foreach (var obj in objectsThatFallOnDeath)
{
obj.AddComponent<Rigidbody>();
if (obj.GetComponent<Collider>() != null) obj.GetComponent<Collider>().enabled = false;
dissolveMaterial = modelObject.GetComponent<SkinnedMeshRenderer>().materials[0];
curDeathSpeed = deathSpeed;
}
var dur = deathDuration;
if (fast)
// Update is called once per frame
private void Update()
{
dur = fastDeathduration;
curDeathSpeed = deathSpeed * (deathDuration / fastDeathduration);
if (isAlive)
{
animator.SetFloat("Speed", speed);
}
else
{
var quantity = dissolveMaterial.GetFloat("_DissolveQuantity");
quantity = Mathf.Lerp(quantity, -2, Time.deltaTime * curDeathSpeed);
dissolveMaterial.SetFloat("_DissolveQuantity", quantity);
}
}
StartCoroutine(destroyAfterSeconds(dur));
}
public void StartMoving()
{
if (isAlive)
{
IsRunning = true;
speed = 1;
}
}
public void StopMoving()
{
if (isAlive)
{
speed = 0;
IsRunning = false;
}
}
public void Attack()
{
if (isAlive) animator.SetTrigger("Attack");
}
private IEnumerator destroyAfterSeconds(float duration)
{
yield return new WaitForSeconds(duration);
Destroy(gameObject);
/// <summary>
/// 0,1,2,3
/// </summary>
/// <param name="attackType"></param>
public void SetAttackType(int attackType)
{
animator.SetInteger("AttackIndex", attackType);
}
public void InLight()
{
if (isAlive)
animator.SetBool("InLight", true);
}
public void NotInLight()
{
if (isAlive)
animator.SetBool("InLight", false);
}
public void AttackScream()
{
if (isAlive)
animator.SetTrigger("AttackScream");
}
public void Kill(bool fast = false)
{
//animator.speed = 0;
InLight();
isAlive = false;
foreach (var obj in objectsThatFallOnDeath)
{
obj.AddComponent<Rigidbody>();
if (obj.GetComponent<Collider>() != null) obj.GetComponent<Collider>().enabled = false;
}
var dur = deathDuration;
if (fast)
{
dur = fastDeathduration;
curDeathSpeed = deathSpeed * (deathDuration / fastDeathduration);
}
StartCoroutine(destroyAfterSeconds(dur));
}
private IEnumerator destroyAfterSeconds(float duration)
{
yield return new WaitForSeconds(duration);
Destroy(gameObject);
}
}
}
}

View File

@ -5,7 +5,7 @@ public class SkinlessMonsterComponent : MonoBehaviour
{
[SerializeField] private NavMeshAgent agent;
[SerializeField] private SkinlessMonsterAnimator animator;
[SerializeField] private Enemy.SkinlessMonsterAnimator animator;
[SerializeField] private float atTargetDistance = 2;
@ -32,12 +32,12 @@ public class SkinlessMonsterComponent : MonoBehaviour
private bool isAlive = true;
private InGameManager manager;
private Game.InGameManager manager;
private Vector3 oppositeVector;
private PlayerComponent player;
private Player.PlayerComponent player;
private TargetInformation target;
private GameObject targetObject;
@ -46,12 +46,12 @@ public class SkinlessMonsterComponent : MonoBehaviour
private void Awake()
{
//Find active player rn.
var players = FindObjectsOfType<PlayerComponent>();
var players = FindObjectsOfType<Player.PlayerComponent>();
foreach (var p in players)
if (p.isActiveAndEnabled)
player = p;
manager = FindObjectOfType<InGameManager>();
manager = FindObjectOfType<Game.InGameManager>();
}
private void Start()
@ -61,7 +61,7 @@ public class SkinlessMonsterComponent : MonoBehaviour
targetObject = new GameObject();
targetObject.name = "Enemy Target";
if (player == null) player = FindObjectOfType<PlayerComponent>();
if (player == null) player = FindObjectOfType<Player.PlayerComponent>();
}
private void Update()
@ -236,10 +236,10 @@ public class SkinlessMonsterComponent : MonoBehaviour
{
var hitObject = hit.transform.gameObject;
if (hitObject.GetComponent<PlayerComponent>() != null)
if (hitObject.GetComponent<Player.PlayerComponent>() != null)
//hit player
return angleToPosition <= visibilityConeLimit || !withAngle;
if (hitObject.GetComponentInParent<PlayerComponent>() != null)
if (hitObject.GetComponentInParent<Player.PlayerComponent>() != null)
//also hit player
return angleToPosition <= visibilityConeLimit || !withAngle;
}

View File

@ -1,22 +1,25 @@
using UnityEngine;
public class DummyComponent : MonoBehaviour
namespace Enemy
{
private Animator anim;
// Start is called before the first frame update
private void Start()
public class DummyComponent : MonoBehaviour
{
anim = GetComponentInParent<Animator>();
}
private Animator anim;
// Update is called once per frame
private void Update()
{
}
// Start is called before the first frame update
private void Start()
{
anim = GetComponentInParent<Animator>();
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.GetComponent<BulletComponent>() != null) anim.Play("DummyFall");
// Update is called once per frame
private void Update()
{
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.GetComponent<BulletComponent>() != null) anim.Play("DummyFall");
}
}
}

View File

@ -1,22 +1,24 @@
using UnityEngine;
public class MonsterComponent : MonoBehaviour
{
[SerializeField] private float attackDamage = 1f;
[SerializeField] private bool shakeCameraOnHit = true;
public float AttackDamage => attackDamage;
public bool ShakeCameraOnHit => shakeCameraOnHit;
// Start is called before the first frame update
private void Start()
namespace Enemy {
public class MonsterComponent : MonoBehaviour
{
}
[SerializeField] private float attackDamage = 1f;
// Update is called once per frame
private void Update()
{
[SerializeField] private bool shakeCameraOnHit = true;
public float AttackDamage => attackDamage;
public bool ShakeCameraOnHit => shakeCameraOnHit;
// Start is called before the first frame update
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
}
}

View File

@ -1,62 +1,65 @@
using UnityEngine;
using UnityEngine.VFX;
[ExecuteAlways]
public class SwarmAnimator : MonoBehaviour
namespace Enemy
{
[SerializeField] private VisualEffect vfx;
[SerializeField] private Rigidbody rb;
//[SerializeField]
//private string parameterName = "DeltaVector";
[SerializeField] private Vector3 avoidancePosDefault;
[SerializeField] private float explodeDuration = 1.0f;
private Vector3 currentPosition;
private float dur;
private bool isExploding;
private Vector3 previousPosition;
// Start is called before the first frame update
private void Start()
[ExecuteAlways]
public class SwarmAnimator : MonoBehaviour
{
}
[SerializeField] private VisualEffect vfx;
// Update is called once per frame
private void Update()
{
previousPosition = currentPosition;
currentPosition = transform.position;
var velocity = currentPosition - previousPosition;
vfx.SetVector3("DeltaVector", velocity);
[SerializeField] private Rigidbody rb;
//[SerializeField]
//private string parameterName = "DeltaVector";
if (Input.GetKeyDown(KeyCode.Space)) Explode();
if (isExploding)
[SerializeField] private Vector3 avoidancePosDefault;
[SerializeField] private float explodeDuration = 1.0f;
private Vector3 currentPosition;
private float dur;
private bool isExploding;
private Vector3 previousPosition;
// Start is called before the first frame update
private void Start()
{
if (dur > explodeDuration) StopExplode();
dur += Time.deltaTime;
}
// Update is called once per frame
private void Update()
{
previousPosition = currentPosition;
currentPosition = transform.position;
var velocity = currentPosition - previousPosition;
vfx.SetVector3("DeltaVector", velocity);
if (Input.GetKeyDown(KeyCode.Space)) Explode();
if (isExploding)
{
if (dur > explodeDuration) StopExplode();
dur += Time.deltaTime;
}
}
private void FixedUpdate()
{
}
private void Explode()
{
vfx.SetVector3("Avoid", transform.position);
isExploding = true;
dur = 0;
//Wait a sec then stop.
}
private void StopExplode()
{
vfx.SetVector3("Avoid", avoidancePosDefault);
isExploding = false;
vfx.Stop();
}
}
private void FixedUpdate()
{
}
private void Explode()
{
vfx.SetVector3("Avoid", transform.position);
isExploding = true;
dur = 0;
//Wait a sec then stop.
}
private void StopExplode()
{
vfx.SetVector3("Avoid", avoidancePosDefault);
isExploding = false;
vfx.Stop();
}
}
}

View File

@ -4,6 +4,8 @@ using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
namespace Game
{
public class InGameManager : MonoBehaviour
{
[SerializeField] private Volume gameVolume;
@ -128,4 +130,5 @@ public class InGameManager : MonoBehaviour
{
SceneManager.LoadScene(0);
}
}
}

View File

@ -1,52 +1,55 @@
using UnityEngine;
using UnityEngine.UI;
public class InGameMenuManager : MonoBehaviour
namespace Game
{
[SerializeField] private Button settingsButton;
[SerializeField] private Button returnToMenuButton;
[SerializeField] private Scrollbar sensitivitySlider;
[SerializeField] private Scrollbar volumeSlider;
private InGameManager gameManager;
private Animator menuAnimator;
private PlayerComponent player;
// Start is called before the first frame update
private void Start()
public class InGameMenuManager : MonoBehaviour
{
menuAnimator = GetComponent<Animator>();
settingsButton.onClick.AddListener(SettingsClicked);
returnToMenuButton.onClick.AddListener(SettingsUnClicked);
player = FindObjectOfType(typeof(PlayerComponent)) as PlayerComponent;
gameManager = FindObjectOfType<InGameManager>();
}
[SerializeField] private Button settingsButton;
// Update is called once per frame
private void Update()
{
}
[SerializeField] private Button returnToMenuButton;
private void SettingsClicked()
{
menuAnimator.SetBool("SettingsOpen", true);
}
[SerializeField] private Scrollbar sensitivitySlider;
private void SettingsUnClicked()
{
menuAnimator.SetBool("SettingsOpen", false);
}
[SerializeField] private Scrollbar volumeSlider;
public void UpdateSensitivity()
{
player.SetSensitivity(sensitivitySlider.value * 4f);
}
private InGameManager gameManager;
private Animator menuAnimator;
private Player.PlayerComponent player;
public void UpdateVolume()
{
gameManager.SetVolume(volumeSlider.value * 2);
// Start is called before the first frame update
private void Start()
{
menuAnimator = GetComponent<Animator>();
settingsButton.onClick.AddListener(SettingsClicked);
returnToMenuButton.onClick.AddListener(SettingsUnClicked);
player = FindObjectOfType(typeof(Player.PlayerComponent)) as Player.PlayerComponent;
gameManager = FindObjectOfType<InGameManager>();
}
// Update is called once per frame
private void Update()
{
}
private void SettingsClicked()
{
menuAnimator.SetBool("SettingsOpen", true);
}
private void SettingsUnClicked()
{
menuAnimator.SetBool("SettingsOpen", false);
}
public void UpdateSensitivity()
{
player.SetSensitivity(sensitivitySlider.value * 4f);
}
public void UpdateVolume()
{
gameManager.SetVolume(volumeSlider.value * 2);
}
}
}

View File

@ -1,5 +1,6 @@
using UnityEngine;
namespace Game {
/// <summary>
/// Attach this behavior to a master room collider. Enables everything in this room OnTriggerEnter of [tag]
/// disables everything in this room OnTriggerExit of [tag]
@ -36,4 +37,5 @@ public class Optimizer : MonoBehaviour
{
foreach (var go in references) go.SetActive(false);
}
}
}

View File

@ -19,7 +19,7 @@ public class GemItem : MonoBehaviour
{
if (collision.gameObject.CompareTag("Player"))
{
collision.gameObject.GetComponent<PlayerMovementController>().SetSpeed(instantSpeed);
collision.gameObject.GetComponent<Player.PlayerMovementController>().SetSpeed(instantSpeed);
Destroy(gameObject);
}
}

View File

@ -44,7 +44,7 @@ public class DoorInteractable : HeavyItemReceiver
//print("DIST:" + dist);
if (dist <= minAttractDist)
{
var _i = PlayerInteractionHandler.instance.Inventory;
var _i = Player.PlayerInteractionHandler.instance.Inventory;
Interact(ref _i, ref item);
return true;
}

View File

@ -62,7 +62,7 @@ public class PistolComponent : MonoBehaviour
{
if (shootLight.gameObject.activeSelf && timeSinceLightDuration > shootLightDuration)
shootLight.gameObject.SetActive(false);
if (aimMode == AimMode.CAMERA) targetObject.gameObject.transform.position = PlayerAim.active.targetPosition;
if (aimMode == AimMode.CAMERA) targetObject.gameObject.transform.position = Player.PlayerAim.active.targetPosition;
if (IsEnabled && aimMode != AimMode.CAMERA)
{
var ray = new Ray(transform.position, transform.up);
@ -144,7 +144,7 @@ public class PistolComponent : MonoBehaviour
if (offsetWithTargetBall || aimMode == AimMode.MODIFIED)
{
var ballCamVector = targetObject.transform.position -
GetComponentInParent<PlayerMovementController>().cam.transform.position;
GetComponentInParent<Player.PlayerMovementController>().cam.transform.position;
var r = new Ray();
r.origin = targetObject.transform.position;
r.direction = ballCamVector.normalized;
@ -157,7 +157,7 @@ public class PistolComponent : MonoBehaviour
}
else if (aimMode == AimMode.CAMERA)
{
var target = PlayerAim.active.targetPosition;
var target = Player.PlayerAim.active.targetPosition;
var lv = target - pRigid.transform.position;
launchVector = lv.normalized;

View File

@ -18,7 +18,7 @@ public class SpecialItemCycler : MonoBehaviour
[SerializeField] private List<ItemImageRef> shootableItems = new();
[SerializeField] private PlayerInteractionHandler interactionHandler;
[SerializeField] private Player.PlayerInteractionHandler interactionHandler;
[SerializeField] private PistolComponent pistol;

View File

@ -25,7 +25,7 @@ public class BasicLevelProgressionSystem : MonoBehaviour
[SerializeField] private WaypointMarker marker;
[SerializeField] private PlayerComponent player;
[SerializeField] private Player.PlayerComponent player;
//[SerializeField]
//private float minDist = 3;
@ -82,7 +82,7 @@ public class BasicLevelProgressionSystem : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.GetComponentInParent<PlayerComponent>() != null) ProgressCurrentIfCollide();
if (other.gameObject.GetComponentInParent<Player.PlayerComponent>() != null) ProgressCurrentIfCollide();
}
private void ProgressCurrentIfCollide()

View File

@ -25,13 +25,13 @@ public class LevelZeroSpecial : MonoBehaviour
[SerializeField] private GameObject exitCollider;
[SerializeField] private PlayerComponent player;
[SerializeField] private Player.PlayerComponent player;
[SerializeField] private WaypointMarker marker2Ref;
[SerializeField] private WaypointMarker marker3Ref;
[SerializeField] private Optimizer finalRoomOptimizer;
[SerializeField] private Game.Optimizer finalRoomOptimizer;
private int countPowered;
private bool isEnabled;

View File

@ -1,49 +1,51 @@
using UnityEngine;
public class CameraController : MonoBehaviour
namespace Player
{
//private float mouseX = 0;
//private float mouseY;
[SerializeField] private Camera cam;
[SerializeField] private Transform target;
private Vector3 offset;
public Vector3 Forward { get; private set; } = Vector3.zero;
public Vector3 Right { get; private set; } = Vector3.zero;
//private float originalDist = 0;
//private float newDist = 0;
//[SerializeField]
// private bool isChild = false;
// Start is called before the first frame update
private void Start()
public class CameraController : MonoBehaviour
{
//private float mouseX = 0;
//private float mouseY;
[SerializeField] private Camera cam;
[SerializeField] private Transform target;
private Vector3 offset;
public Vector3 Forward { get; private set; } = Vector3.zero;
public Vector3 Right { get; private set; } = Vector3.zero;
//private float originalDist = 0;
//private float newDist = 0;
//[SerializeField]
// private bool isChild = false;
// Start is called before the first frame update
private void Start()
{
}
// Update is called once per frame
private void Update()
{
GetMouseLook();
//if(target!=null&&!isChild)
//transform.position = target.transform.position+offset;
Forward = new Vector3(cam.transform.forward.x, target.transform.forward.y, cam.transform.forward.z);
Right = new Vector3(cam.transform.right.x, target.transform.right.y, cam.transform.right.z);
}
private void GetMouseLook()
{
//mouseX = Input.GetAxis("Mouse X");
//mouseY = Input.GetAxis("Mouse Y");
//transform.Rotate(0, mouseX * Time.deltaTime * 180f, 0);
//cam.transform.parent.parent.transform.Rotate(mouseY * Time.deltaTime * 180f, 0, 0);
//Cursor.visible = false;
//Cursor.lockState = CursorLockMode.Locked;
}
}
// Update is called once per frame
private void Update()
{
GetMouseLook();
//if(target!=null&&!isChild)
//transform.position = target.transform.position+offset;
Forward = new Vector3(cam.transform.forward.x, target.transform.forward.y, cam.transform.forward.z);
Right = new Vector3(cam.transform.right.x, target.transform.right.y, cam.transform.right.z);
}
private void GetMouseLook()
{
//mouseX = Input.GetAxis("Mouse X");
//mouseY = Input.GetAxis("Mouse Y");
//transform.Rotate(0, mouseX * Time.deltaTime * 180f, 0);
//cam.transform.parent.parent.transform.Rotate(mouseY * Time.deltaTime * 180f, 0, 0);
//Cursor.visible = false;
//Cursor.lockState = CursorLockMode.Locked;
}
}
}

View File

@ -1,62 +1,65 @@
using Cinemachine;
using UnityEngine;
public class CameraShift : MonoBehaviour
namespace Player
{
public static CameraShift active;
[SerializeField] private Camera childCam;
[SerializeField] private Transform offset;
[SerializeField] private float cameraSpeed = 5f;
[SerializeField] private CinemachineFreeLook freelook;
[SerializeField] private float initRadius = 3f;
[SerializeField] private float aimingRadius = 2f;
private bool isCenter = true;
private Vector3 targetOffset;
// Start is called before the first frame update
private void Start()
public class CameraShift : MonoBehaviour
{
targetOffset = Vector3.zero;
}
public static CameraShift active;
// Update is called once per frame
private void Update()
{
active = this;
if (isCenter)
[SerializeField] private Camera childCam;
[SerializeField] private Transform offset;
[SerializeField] private float cameraSpeed = 5f;
[SerializeField] private CinemachineFreeLook freelook;
[SerializeField] private float initRadius = 3f;
[SerializeField] private float aimingRadius = 2f;
private bool isCenter = true;
private Vector3 targetOffset;
// Start is called before the first frame update
private void Start()
{
targetOffset = Vector3.zero;
freelook.m_Orbits[1].m_Radius =
Mathf.Lerp(freelook.m_Orbits[1].m_Radius, initRadius, Time.deltaTime * cameraSpeed);
}
else
// Update is called once per frame
private void Update()
{
targetOffset = offset.localPosition;
freelook.m_Orbits[1].m_Radius =
Mathf.Lerp(freelook.m_Orbits[1].m_Radius, aimingRadius, Time.deltaTime * cameraSpeed);
active = this;
if (isCenter)
{
targetOffset = Vector3.zero;
freelook.m_Orbits[1].m_Radius =
Mathf.Lerp(freelook.m_Orbits[1].m_Radius, initRadius, Time.deltaTime * cameraSpeed);
}
else
{
targetOffset = offset.localPosition;
freelook.m_Orbits[1].m_Radius =
Mathf.Lerp(freelook.m_Orbits[1].m_Radius, aimingRadius, Time.deltaTime * cameraSpeed);
}
childCam.transform.localPosition =
Vector3.Lerp(childCam.transform.localPosition, targetOffset, Time.deltaTime * cameraSpeed);
}
//[SerializeField]
//private PlayerMovementController movementController;
public void ToggleCenter()
{
isCenter = !isCenter;
}
childCam.transform.localPosition =
Vector3.Lerp(childCam.transform.localPosition, targetOffset, Time.deltaTime * cameraSpeed);
}
//[SerializeField]
//private PlayerMovementController movementController;
public void ToggleCenter()
{
isCenter = !isCenter;
}
public void SetCenter(bool isCenter)
{
this.isCenter = isCenter;
public void SetCenter(bool isCenter)
{
this.isCenter = isCenter;
}
}
}

View File

@ -1,62 +1,65 @@
using UnityEngine;
public class NoiseVisibilitySettingsManager : MonoBehaviour
namespace Player
{
[SerializeField] private float sneakNoiseDistance = 5f;
[SerializeField] private float runNoiseDistance = 10f;
[SerializeField] private float shootNoiseDistance = 30f;
[SerializeField] private float standNoiseDistance;
[SerializeField] private float shootNoiseDuration = 2f;
private bool isRunning;
private bool isSneaking;
private float timeSinceLastShot;
public float SneakNoiseDistance => sneakNoiseDistance;
public float RunNoiseDistance => runNoiseDistance;
public float ShootNoiseDistance => shootNoiseDistance;
public float StandNoiseDistance => standNoiseDistance;
public float NoiseDistance { get; private set; }
// Start is called before the first frame update
private void Start()
public class NoiseVisibilitySettingsManager : MonoBehaviour
{
}
[SerializeField] private float sneakNoiseDistance = 5f;
// Update is called once per frame
private void Update()
{
if (timeSinceLastShot > 0)
NoiseDistance = shootNoiseDistance;
else if (isRunning)
NoiseDistance = runNoiseDistance;
else if (isSneaking)
NoiseDistance = sneakNoiseDistance;
else
NoiseDistance = standNoiseDistance;
[SerializeField] private float runNoiseDistance = 10f;
timeSinceLastShot -= Time.deltaTime;
}
[SerializeField] private float shootNoiseDistance = 30f;
public void ShotFired()
{
timeSinceLastShot = shootNoiseDuration;
}
[SerializeField] private float standNoiseDistance;
public void SetRunning(bool isRunning)
{
this.isRunning = isRunning;
}
[SerializeField] private float shootNoiseDuration = 2f;
public void SetSneaking(bool isSneaking)
{
this.isSneaking = isSneaking;
private bool isRunning;
private bool isSneaking;
private float timeSinceLastShot;
public float SneakNoiseDistance => sneakNoiseDistance;
public float RunNoiseDistance => runNoiseDistance;
public float ShootNoiseDistance => shootNoiseDistance;
public float StandNoiseDistance => standNoiseDistance;
public float NoiseDistance { get; private set; }
// Start is called before the first frame update
private void Start()
{
}
// Update is called once per frame
private void Update()
{
if (timeSinceLastShot > 0)
NoiseDistance = shootNoiseDistance;
else if (isRunning)
NoiseDistance = runNoiseDistance;
else if (isSneaking)
NoiseDistance = sneakNoiseDistance;
else
NoiseDistance = standNoiseDistance;
timeSinceLastShot -= Time.deltaTime;
}
public void ShotFired()
{
timeSinceLastShot = shootNoiseDuration;
}
public void SetRunning(bool isRunning)
{
this.isRunning = isRunning;
}
public void SetSneaking(bool isSneaking)
{
this.isSneaking = isSneaking;
}
}
}

View File

@ -1,24 +1,27 @@
using UnityEngine;
public class PlayerAim : MonoBehaviour
namespace Player
{
public static PlayerAim active;
public Vector3 targetPosition;
private Camera cam;
// Start is called before the first frame update
private void Start()
public class PlayerAim : MonoBehaviour
{
active = this;
cam = GetComponent<Camera>();
}
public static PlayerAim active;
public Vector3 targetPosition;
// Update is called once per frame
private void Update()
{
var r = new Ray(cam.transform.position, cam.transform.forward);
RaycastHit hit;
if (Physics.Raycast(r, out hit)) targetPosition = hit.point;
private Camera cam;
// Start is called before the first frame update
private void Start()
{
active = this;
cam = GetComponent<Camera>();
}
// Update is called once per frame
private void Update()
{
var r = new Ray(cam.transform.position, cam.transform.forward);
RaycastHit hit;
if (Physics.Raycast(r, out hit)) targetPosition = hit.point;
}
}
}

View File

@ -1,116 +1,120 @@
using UnityEngine;
public class PlayerAnimationController : MonoBehaviour
namespace Player
{
[SerializeField] private Animator animController;
[SerializeField] private string runningParameter;
[SerializeField] private string runningSpeedParameter;
[SerializeField] private string sideStepSpeedParameter;
//private bool movementInterrupt = false;
[SerializeField] private PlayerInteractionHandler interactionHandler;
[SerializeField] private PlayerMovementController movement;
//private float verticalAiming = 0;
[SerializeField] private Camera hiddenCam;
private bool isRunning;
private float runningSpeed;
private float sideStepSpeed;
// Start is called before the first frame update
private void Start()
public class PlayerAnimationController : MonoBehaviour
{
}
[SerializeField] private Animator animController;
// Update is called once per frame
private void Update()
{
animController.SetBool("IsCarrying", interactionHandler.IsCarrying);
animController.SetBool("HasGun", interactionHandler.GunEnabled);
[SerializeField] private string runningParameter;
if (interactionHandler.GunEnabled && !interactionHandler.isDead && movement.AllowRotation)
[SerializeField] private string runningSpeedParameter;
[SerializeField] private string sideStepSpeedParameter;
//private bool movementInterrupt = false;
[SerializeField] private PlayerInteractionHandler interactionHandler;
[SerializeField] private PlayerMovementController movement;
//private float verticalAiming = 0;
[SerializeField] private Camera hiddenCam;
private bool isRunning;
private float runningSpeed;
private float sideStepSpeed;
// Start is called before the first frame update
private void Start()
{
if (hiddenCam.transform.localEulerAngles.x < 90)
}
// Update is called once per frame
private void Update()
{
animController.SetBool("IsCarrying", interactionHandler.IsCarrying);
animController.SetBool("HasGun", interactionHandler.GunEnabled);
if (interactionHandler.GunEnabled && !interactionHandler.isDead && movement.AllowRotation)
{
//DOWN
var target = Mathf.Lerp(animController.GetLayerWeight(3), hiddenCam.transform.localEulerAngles.x / 70f,
Time.deltaTime * 10f);
animController.SetLayerWeight(3, target);
animController.SetLayerWeight(2, 0);
if (hiddenCam.transform.localEulerAngles.x < 90)
{
//DOWN
var target = Mathf.Lerp(animController.GetLayerWeight(3), hiddenCam.transform.localEulerAngles.x / 70f,
Time.deltaTime * 10f);
animController.SetLayerWeight(3, target);
animController.SetLayerWeight(2, 0);
}
else
{
//UP
animController.SetLayerWeight(3, 0);
var target = Mathf.Lerp(animController.GetLayerWeight(2),
(360f - hiddenCam.transform.localEulerAngles.x) / (360f - 300f), Time.deltaTime * 10);
animController.SetLayerWeight(2, target);
}
}
else
{
//UP
animController.SetLayerWeight(3, 0);
var target = Mathf.Lerp(animController.GetLayerWeight(2),
(360f - hiddenCam.transform.localEulerAngles.x) / (360f - 300f), Time.deltaTime * 10);
animController.SetLayerWeight(2, target);
animController.SetLayerWeight(2, Mathf.Lerp(animController.GetLayerWeight(2), 0, Time.deltaTime * 10));
animController.SetLayerWeight(3, Mathf.Lerp(animController.GetLayerWeight(3), 0, Time.deltaTime * 10));
}
//print("carrying:" + interactionHandler.IsCarrying + " running:"+animController.GetBool(runningParameter)+" running speed:" + animController.GetFloat(runningSpeedParameter));
}
public void Animate(Vector2 movement, bool jump, bool isMoving)
{
animController.SetFloat(runningSpeedParameter, movement.magnitude);
animController.SetBool(runningParameter, isMoving);
if (this.movement.IsAiming)
{
animController.SetFloat("StrafingSpeed", movement.x);
float dir = 0;
if (movement.x > 0)
dir = 1;
else if (movement.x < 0) dir = -1;
animController.SetFloat("StrafingDirection", dir);
}
else
{
animController.SetFloat("StrafingSpeed", 0);
animController.SetFloat("StrafingDirection", 1);
}
}
else
public void Animate(PlayerQuickAnimationType animation)
{
animController.SetLayerWeight(2, Mathf.Lerp(animController.GetLayerWeight(2), 0, Time.deltaTime * 10));
animController.SetLayerWeight(3, Mathf.Lerp(animController.GetLayerWeight(3), 0, Time.deltaTime * 10));
switch (animation)
{
case PlayerQuickAnimationType.Grab:
print("grabbing...");
break;
case PlayerQuickAnimationType.Shoot:
print("shooting...");
break;
}
}
//print("carrying:" + interactionHandler.IsCarrying + " running:"+animController.GetBool(runningParameter)+" running speed:" + animController.GetFloat(runningSpeedParameter));
public void Hit(bool isDead)
{
animController.SetTrigger("WasHit");
animController.SetBool("IsDead", isDead);
}
}
public void Animate(Vector2 movement, bool jump, bool isMoving)
public enum PlayerAnimationType
{
animController.SetFloat(runningSpeedParameter, movement.magnitude);
animController.SetBool(runningParameter, isMoving);
if (this.movement.IsAiming)
{
animController.SetFloat("StrafingSpeed", movement.x);
float dir = 0;
if (movement.x > 0)
dir = 1;
else if (movement.x < 0) dir = -1;
animController.SetFloat("StrafingDirection", dir);
}
else
{
animController.SetFloat("StrafingSpeed", 0);
animController.SetFloat("StrafingDirection", 1);
}
Movement,
Action
}
public void Animate(PlayerQuickAnimationType animation)
public enum PlayerQuickAnimationType
{
switch (animation)
{
case PlayerQuickAnimationType.Grab:
print("grabbing...");
break;
case PlayerQuickAnimationType.Shoot:
print("shooting...");
break;
}
Grab,
Shoot
}
public void Hit(bool isDead)
{
animController.SetTrigger("WasHit");
animController.SetBool("IsDead", isDead);
}
}
public enum PlayerAnimationType
{
Movement,
Action
}
public enum PlayerQuickAnimationType
{
Grab,
Shoot
}

View File

@ -1,104 +1,107 @@
using Cinemachine;
using UnityEngine;
public class PlayerComponent : MonoBehaviour
namespace Player
{
[SerializeField] private float health = 5f;
[SerializeField] private float maxHealth = 5f;
[SerializeField] private float stamina = 20f;
[SerializeField] private float maxStamina = 20f;
[SerializeField] private NoiseVisibilitySettingsManager noiseManager;
[SerializeField] private PlayerMovementController movementController;
[SerializeField] private PlayerAnimationController animationController;
[HideInInspector] public FlareRegister flareRegister;
[SerializeField] private CinemachineFreeLook cameraFreeLook;
[SerializeField] private float knockbackDuration = 1f;
[SerializeField] private float knockbackDistance = 5f;
[SerializeField] private StatsOutputScreen statsOutput;
private CinemachineBasicMultiChannelPerlin perlin;
private float shakeTimer;
public NoiseVisibilitySettingsManager NoiseManager => noiseManager;
public PlayerMovementController MovementController => movementController;
[HideInInspector] public bool IsAlive => health > 0;
private void Awake()
public class PlayerComponent : MonoBehaviour
{
flareRegister = FindObjectOfType<FlareRegister>();
}
[SerializeField] private float health = 5f;
// Start is called before the first frame update
private void Start()
{
perlin = cameraFreeLook.GetRig(1).GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
}
[SerializeField] private float maxHealth = 5f;
// Update is called once per frame
private void Update()
{
NoiseManager.SetRunning(MovementController.IsRunning);
statsOutput.health = health;
statsOutput.stamina = 20f;
statsOutput.oxygen = 100f;
[SerializeField] private float stamina = 20f;
if (shakeTimer > 0)
[SerializeField] private float maxStamina = 20f;
[SerializeField] private NoiseVisibilitySettingsManager noiseManager;
[SerializeField] private PlayerMovementController movementController;
[SerializeField] private PlayerAnimationController animationController;
[HideInInspector] public FlareRegister flareRegister;
[SerializeField] private CinemachineFreeLook cameraFreeLook;
[SerializeField] private float knockbackDuration = 1f;
[SerializeField] private float knockbackDistance = 5f;
[SerializeField] private StatsOutputScreen statsOutput;
private CinemachineBasicMultiChannelPerlin perlin;
private float shakeTimer;
public NoiseVisibilitySettingsManager NoiseManager => noiseManager;
public PlayerMovementController MovementController => movementController;
[HideInInspector] public bool IsAlive => health > 0;
private void Awake()
{
shakeTimer -= Time.deltaTime;
// perlin.m_AmplitudeGain = 0;
perlin.m_AmplitudeGain = Mathf.Lerp(perlin.m_AmplitudeGain, 0, .1f);
if (shakeTimer <= 0f) perlin.m_AmplitudeGain = 0;
flareRegister = FindObjectOfType<FlareRegister>();
}
if (!IsAlive)
// Start is called before the first frame update
private void Start()
{
PlayerInteractionHandler.instance.isDead = true;
movementController.isDead = true;
perlin = cameraFreeLook.GetRig(1).GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
}
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Damaging"))
// Update is called once per frame
private void Update()
{
print("HIT!");
var monster = other.GetComponentInParent<MonsterComponent>();
NoiseManager.SetRunning(MovementController.IsRunning);
statsOutput.health = health;
statsOutput.stamina = 20f;
statsOutput.oxygen = 100f;
Damage(monster.AttackDamage, monster.ShakeCameraOnHit);
animationController.Hit(health <= 0);
movementController.PhysicalForceMove((transform.position - monster.transform.position) * knockbackDistance);
movementController.LockMovement(knockbackDuration);
if (shakeTimer > 0)
{
shakeTimer -= Time.deltaTime;
// perlin.m_AmplitudeGain = 0;
perlin.m_AmplitudeGain = Mathf.Lerp(perlin.m_AmplitudeGain, 0, .1f);
if (shakeTimer <= 0f) perlin.m_AmplitudeGain = 0;
}
if (!IsAlive)
{
PlayerInteractionHandler.instance.isDead = true;
movementController.isDead = true;
}
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Damaging"))
{
print("HIT!");
var monster = other.GetComponentInParent<Enemy.MonsterComponent>();
Damage(monster.AttackDamage, monster.ShakeCameraOnHit);
animationController.Hit(health <= 0);
movementController.PhysicalForceMove((transform.position - monster.transform.position) * knockbackDistance);
movementController.LockMovement(knockbackDuration);
}
}
}
public void ShakeCamera(float intensity, float time)
{
var perlin = cameraFreeLook.GetRig(1).GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
perlin.m_AmplitudeGain = intensity;
shakeTimer = time;
}
public void ShakeCamera(float intensity, float time)
{
var perlin = cameraFreeLook.GetRig(1).GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
perlin.m_AmplitudeGain = intensity;
shakeTimer = time;
}
public void SetSensitivity(float magnitude)
{
movementController.SetSensitivity(magnitude);
}
public void SetSensitivity(float magnitude)
{
movementController.SetSensitivity(magnitude);
}
public void Damage(float damage, bool applyShake = false)
{
health -= damage;
if (applyShake) ShakeCamera(15, 5);
public void Damage(float damage, bool applyShake = false)
{
health -= damage;
if (applyShake) ShakeCamera(15, 5);
}
}
}

View File

@ -1,6 +1,10 @@
using System.Collections.Generic;
using UnityEngine;
namespace Player
{
[RequireComponent(typeof(Collider))]
public class PlayerInteractionHandler : MonoBehaviour
{
@ -36,7 +40,7 @@ public class PlayerInteractionHandler : MonoBehaviour
private ItemSelector itemSelector;
private readonly List<InteractableItem> itemsInRange = new();
private InGameManager manager;
private Game.InGameManager manager;
private Material selMaterial;
private TempInventory tempInvent;
public Inventory Inventory => invent;
@ -58,7 +62,7 @@ public class PlayerInteractionHandler : MonoBehaviour
itemSelector = ItemSelector.instance;
pistol.gameObject.SetActive(GunEnabled);
flashlightEnabled = flashlight.gameObject.activeSelf;
manager = FindObjectOfType<InGameManager>();
manager = FindObjectOfType<Game.InGameManager>();
}
// Update is called once per frame
@ -313,4 +317,6 @@ internal class AxisIsDown
{
return down;
}
}
}

View File

@ -2,162 +2,166 @@ using System.Collections;
using Cinemachine;
using UnityEngine;
public class PlayerMovementController : MonoBehaviour
namespace Player
{
[SerializeField] private PlayerAnimationController animcontroller;
[SerializeField] private CharacterController ccontroller;
[SerializeField] private CameraController cameraController;
[SerializeField] private float speed = 1f;
[SerializeField] private float sideSpeed = 0.5f;
[SerializeField] private float animatedRotationSpeed = 5f;
[SerializeField] public Camera cam;
[HideInInspector] public bool AllowRotation;
[HideInInspector] public bool IsAiming;
[SerializeField] private NoiseVisibilitySettingsManager noiseSettings;
[SerializeField] private CinemachineFreeLook freelook;
[SerializeField] private string mouseXAxis = "Mouse X";
[SerializeField] private string mouseYAxis = "Mouse Y";
public bool isDead;
private CharacterControllerForce ccForceAddon;
private float initXSensitivity = 250f;
private float initYSensitivity = 10f;
//private float mouseX = 0;
private bool isSneaking = false;
private Vector3 lookingDirectionVector;
private InGameManager manager;
private bool movementLocked;
private float x;
private float y;
public bool IsRunning { get; private set; }
public float NoiseDistance => noiseSettings.NoiseDistance;
// Start is called before the first frame update
private void Start()
public class PlayerMovementController : MonoBehaviour
{
ccForceAddon = ccontroller.gameObject.GetComponent<CharacterControllerForce>();
manager = FindObjectOfType<InGameManager>();
initXSensitivity = freelook.m_XAxis.m_MaxSpeed;
initYSensitivity = freelook.m_YAxis.m_MaxSpeed;
}
[SerializeField] private PlayerAnimationController animcontroller;
// Update is called once per frame
private void Update()
{
if (isDead) return;
AllowRotation = IsAiming || IsRunning;
IsAiming = Input.GetMouseButton(1) || Input.GetAxis("Aim") > 0.5f;
GetMovementOld();
MovePlayer();
[SerializeField] private CharacterController ccontroller;
animcontroller.Animate(new Vector2(x, y), false, IsRunning);
[SerializeField] private CameraController cameraController;
lookingDirectionVector = (cameraController.Forward * y + cameraController.Right * x).normalized;
if ((IsRunning && !Input.GetMouseButtonDown(1)) || AllowRotation)
[SerializeField] private float speed = 1f;
[SerializeField] private float sideSpeed = 0.5f;
[SerializeField] private float animatedRotationSpeed = 5f;
[SerializeField] public Camera cam;
[HideInInspector] public bool AllowRotation;
[HideInInspector] public bool IsAiming;
[SerializeField] private NoiseVisibilitySettingsManager noiseSettings;
[SerializeField] private CinemachineFreeLook freelook;
[SerializeField] private string mouseXAxis = "Mouse X";
[SerializeField] private string mouseYAxis = "Mouse Y";
public bool isDead;
private CharacterControllerForce ccForceAddon;
private float initXSensitivity = 250f;
private float initYSensitivity = 10f;
//private float mouseX = 0;
private bool isSneaking = false;
private Vector3 lookingDirectionVector;
private Game.InGameManager manager;
private bool movementLocked;
private float x;
private float y;
public bool IsRunning { get; private set; }
public float NoiseDistance => noiseSettings.NoiseDistance;
// Start is called before the first frame update
private void Start()
{
ccForceAddon = ccontroller.gameObject.GetComponent<CharacterControllerForce>();
manager = FindObjectOfType<Game.InGameManager>();
initXSensitivity = freelook.m_XAxis.m_MaxSpeed;
initYSensitivity = freelook.m_YAxis.m_MaxSpeed;
}
// Update is called once per frame
private void Update()
{
if (isDead) return;
AllowRotation = IsAiming || IsRunning;
IsAiming = Input.GetMouseButton(1) || Input.GetAxis("Aim") > 0.5f;
GetMovementOld();
MovePlayer();
animcontroller.Animate(new Vector2(x, y), false, IsRunning);
lookingDirectionVector = (cameraController.Forward * y + cameraController.Right * x).normalized;
if ((IsRunning && !Input.GetMouseButtonDown(1)) || AllowRotation)
{
if ((AllowRotation && x == 0 && y == 0) || (IsAiming && PlayerInteractionHandler.instance.GunEnabled))
lookingDirectionVector = cameraController.Forward.normalized;
SlowLookAt(lookingDirectionVector);
}
freelook.m_XAxis.m_InputAxisName = !manager.IsPaused ? mouseXAxis : "";
freelook.m_YAxis.m_InputAxisName = !manager.IsPaused ? mouseYAxis : "";
}
private void GetMovementOld()
{
x = Input.GetAxis("Horizontal");
y = Input.GetAxis("Vertical");
if (movementLocked || manager.IsPaused)
{
x = 0;
y = 0;
}
IsRunning = Mathf.Abs(y) > 0.1f || Mathf.Abs(x) > 0.1f;
}
public void SetSensitivity(float sensitivity)
{
freelook.m_XAxis.m_MaxSpeed = initXSensitivity * sensitivity;
freelook.m_YAxis.m_MaxSpeed = initYSensitivity * sensitivity;
}
private void MovePlayer()
{
var movement = Vector3.zero;
//movement += transform.forward * Mathf.Abs(y) * Time.deltaTime * speed;//+(transform.right*x*Time.deltaTime*speed);
movement += cam.transform.forward * y * Time.deltaTime * speed;
//movement += transform.forward * Mathf.Abs(x) * Time.deltaTime * speed;
if (!IsAiming)
movement += cam.transform.right * x * Time.deltaTime * speed;
else
movement += cam.transform.right * x * Time.deltaTime * sideSpeed;
movement += Vector3.down * Time.deltaTime * 9.8f;
ccontroller.Move(movement);
}
public void SetSpeed(float speed)
{
this.speed = speed;
}
private void GetJumpOld()
{
if ((AllowRotation && x == 0 && y == 0) || (IsAiming && PlayerInteractionHandler.instance.GunEnabled))
lookingDirectionVector = cameraController.Forward.normalized;
SlowLookAt(lookingDirectionVector);
}
freelook.m_XAxis.m_InputAxisName = !manager.IsPaused ? mouseXAxis : "";
freelook.m_YAxis.m_InputAxisName = !manager.IsPaused ? mouseYAxis : "";
}
private void GetMovementOld()
{
x = Input.GetAxis("Horizontal");
y = Input.GetAxis("Vertical");
if (movementLocked || manager.IsPaused)
private void SlowLookAt(Vector3 targetVector)
{
x = 0;
y = 0;
var relativePos = targetVector;
var toRotation = Quaternion.LookRotation(relativePos);
transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, animatedRotationSpeed * Time.deltaTime);
}
IsRunning = Mathf.Abs(y) > 0.1f || Mathf.Abs(x) > 0.1f;
}
public void SetSensitivity(float sensitivity)
{
freelook.m_XAxis.m_MaxSpeed = initXSensitivity * sensitivity;
freelook.m_YAxis.m_MaxSpeed = initYSensitivity * sensitivity;
}
public void PhysicalForceMove(Vector3 vector)
{
ccontroller.Move(vector);
ccForceAddon.AddImpact(vector, vector.magnitude);
}
private void MovePlayer()
{
var movement = Vector3.zero;
//movement += transform.forward * Mathf.Abs(y) * Time.deltaTime * speed;//+(transform.right*x*Time.deltaTime*speed);
movement += cam.transform.forward * y * Time.deltaTime * speed;
public void LockMovement(float duration)
{
StartCoroutine(lockMovement(duration));
}
//movement += transform.forward * Mathf.Abs(x) * Time.deltaTime * speed;
if (!IsAiming)
movement += cam.transform.right * x * Time.deltaTime * speed;
else
movement += cam.transform.right * x * Time.deltaTime * sideSpeed;
movement += Vector3.down * Time.deltaTime * 9.8f;
ccontroller.Move(movement);
}
public void SetSpeed(float speed)
{
this.speed = speed;
}
private void GetJumpOld()
{
}
private void SlowLookAt(Vector3 targetVector)
{
var relativePos = targetVector;
var toRotation = Quaternion.LookRotation(relativePos);
transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, animatedRotationSpeed * Time.deltaTime);
}
public void PhysicalForceMove(Vector3 vector)
{
ccontroller.Move(vector);
ccForceAddon.AddImpact(vector, vector.magnitude);
}
public void LockMovement(float duration)
{
StartCoroutine(lockMovement(duration));
}
private IEnumerator lockMovement(float duration)
{
movementLocked = true;
yield return new WaitForSeconds(duration);
movementLocked = false;
private IEnumerator lockMovement(float duration)
{
movementLocked = true;
yield return new WaitForSeconds(duration);
movementLocked = false;
}
}
}

View File

@ -1,49 +1,52 @@
using TMPro;
using UnityEngine;
public class StatsOutputScreen : MonoBehaviour
namespace Player
{
[SerializeField] private TMP_Text healthText;
[SerializeField] private TMP_Text staminaText;
[SerializeField] private TMP_Text oxygenText;
[HideInInspector] public float health;
[HideInInspector] public float stamina;
[HideInInspector] public float oxygen;
private Color initColor;
// Start is called before the first frame update
private void Start()
public class StatsOutputScreen : MonoBehaviour
{
initColor = healthText.color;
InvokeRepeating("ToggleColor", 0.5f, 0.5f);
[SerializeField] private TMP_Text healthText;
[SerializeField] private TMP_Text staminaText;
[SerializeField] private TMP_Text oxygenText;
[HideInInspector] public float health;
[HideInInspector] public float stamina;
[HideInInspector] public float oxygen;
private Color initColor;
// Start is called before the first frame update
private void Start()
{
initColor = healthText.color;
InvokeRepeating("ToggleColor", 0.5f, 0.5f);
}
// Update is called once per frame
private void Update()
{
healthText.text = "Health:" + health;
if (health <= 1)
//Dark Red
healthText.color = new Color(50, 0, 0);
else if (health <= 3)
healthText.color = Color.red;
else
healthText.color = initColor;
staminaText.text = "Stamina:" + stamina;
oxygenText.text = "Oxygen:" + oxygen;
}
private void ToggleColor()
{
if (health <= 1)
healthText.gameObject.SetActive(!healthText.gameObject.activeSelf);
}
}
// Update is called once per frame
private void Update()
{
healthText.text = "Health:" + health;
if (health <= 1)
//Dark Red
healthText.color = new Color(50, 0, 0);
else if (health <= 3)
healthText.color = Color.red;
else
healthText.color = initColor;
staminaText.text = "Stamina:" + stamina;
oxygenText.text = "Oxygen:" + oxygen;
}
private void ToggleColor()
{
if (health <= 1)
healthText.gameObject.SetActive(!healthText.gameObject.activeSelf);
}
}
}