basic equipment system #32

This commit is contained in:
Rowan 2025-08-14 19:11:32 -04:00
parent 8d093c5538
commit 5f99039a69
216 changed files with 5787 additions and 1774 deletions

View file

@ -0,0 +1,217 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1107 &-7915675896728613497
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 6826455873899848278}
m_Position: {x: 310, y: 120, z: 0}
- serializedVersion: 1
m_State: {fileID: 1083569221786146706}
m_Position: {x: 310, y: 180, z: 0}
- serializedVersion: 1
m_State: {fileID: 6498646189330502375}
m_Position: {x: 550, y: 120, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 6826455873899848278}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Dummy
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Hit
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: Die
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -7915675896728613497}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &1083569221786146706
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Falling Back Death
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -203655887218126122, guid: 48e1cb17fc54eb58ea2fd96b1b8c481b, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &1543474569028406026
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6826455873899848278}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.73214287
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5132201050219580291
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Die
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1083569221786146706}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &6274153639818441180
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Hit
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6498646189330502375}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &6498646189330502375
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Head Hit
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 1543474569028406026}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -203655887218126122, guid: eb8ac924f016b1e33bcfd22c5db3b3e6, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &6826455873899848278
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Empty
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 5132201050219580291}
- {fileID: 6274153639818441180}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

View file

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 12d6aff0f2ce160ac8660ee5c8c47b71
folderAsset: yes
DefaultImporter:
guid: e48039382405808f08691dc1cb984c22
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -20,7 +20,7 @@ AnimatorStateTransition:
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.9025974
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
@ -45,7 +45,7 @@ AnimatorStateTransition:
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.8125
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1

View file

@ -24,11 +24,38 @@
"interactions": "",
"initialStateCheck": true
},
{
"name": "Ready",
"type": "Button",
"id": "43858dfd-eb1e-4d25-81c9-786eda9f383b",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Attack",
"type": "Button",
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Reload",
"type": "Button",
"id": "8901b52c-9d31-48a0-960d-340a765f6808",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Use Secondary",
"type": "Button",
"id": "5588bce1-4ae1-4cda-8730-838650924709",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
@ -235,7 +262,7 @@
{
"name": "",
"id": "8c8e490b-c610-4785-884f-f04217b23ca4",
"path": "<Pointer>/delta",
"path": "<Pointer>/position",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse;Touch",
@ -257,7 +284,7 @@
{
"name": "",
"id": "143bb1cd-cc10-4eca-a2f0-a3664166fe91",
"path": "<Gamepad>/buttonWest",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
@ -473,6 +500,83 @@
"action": "Crouch",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "af1e1636-b5d4-48fc-b772-2c52cd333dee",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Ready",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "16cef02c-a624-41d1-86a5-ed36aa8f5549",
"path": "<Gamepad>/leftTrigger",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "Ready",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "393f477f-f65c-4261-ac56-d13b3530c802",
"path": "<Gamepad>/leftShoulder",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "Use Secondary",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6d75d42e-db1f-4750-9a67-33cedba396f7",
"path": "<Keyboard>/c",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Use Secondary",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "7c03549b-c6f7-40d8-9c57-b7f32c4c3dd8",
"path": "<Mouse>/backButton",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Use Secondary",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3994a53b-2dc2-4307-80cc-a99822fc6d0c",
"path": "<Keyboard>/r",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Reload",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "27ccb790-118c-4aa8-a9a4-e037c8382d3c",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "Reload",
"isComposite": false,
"isPartOfComposite": false
}
]
},

View file

@ -8,7 +8,7 @@ ScriptedImporter:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
generateWrapperCode: 0
wrapperCodePath: Assets/Scripts/Input/InputSystem_Actions.cs
wrapperClassName:
wrapperCodeNamespace:

BIN
Assets/Resources/Dummy.fbx Normal file

Binary file not shown.

View file

@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: 015f1ddb77bbd0ce980de36f9e227c78
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
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
importPhysicalCameras: 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
strictVertexDataChecks: 0
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
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,136 @@
fileFormatVersion: 2
guid: 48e1cb17fc54eb58ea2fd96b1b8c481b
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
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:
- serializedVersion: 16
name: Falling Back Death
takeName: mixamo.com
internalID: -203655887218126122
firstFrame: 0
lastFrame: 78
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
hasAdditiveReferencePose: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 3
maskSource: {instanceID: 0}
additiveReferencePoseFrame: 0
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 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
strictVertexDataChecks: 0
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
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,155 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3189041518118701393
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4498264122734214993}
m_Layer: 0
m_Name: Origin
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4498264122734214993
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3189041518118701393}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0.375, z: -1.2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 980965867932805622}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1001 &727241450723970589
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalScale.x
value: 0.11
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalScale.y
value: 0.11
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalScale.z
value: 0.11
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalPosition.x
value: -0.025
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalPosition.y
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalPosition.z
value: 0.0365
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalRotation.w
value: 0.3984397
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalRotation.x
value: 0.56903094
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalRotation.y
value: -0.58924866
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalRotation.z
value: 0.4125963
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 70
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 180
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 272
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
propertyPath: m_Name
value: Glock17Equipped
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
insertIndex: -1
addedObject: {fileID: 4498264122734214993}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
insertIndex: -1
addedObject: {fileID: 5741563885454826239}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
insertIndex: -1
addedObject: {fileID: -6843496421257318028}
m_SourcePrefab: {fileID: 100100000, guid: bf9d862a19647f28795df2e666425003, type: 3}
--- !u!1 &492801038359376716 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
m_PrefabInstance: {fileID: 727241450723970589}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5741563885454826239
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 492801038359376716}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a9bef8fb859e614a48357ece1c529698, type: 3}
m_Name:
m_EditorClassIdentifier:
ready: {fileID: 11400000, guid: 11f0f1ff4a0ab250ba395b772f722ffb, type: 2}
fire: {fileID: 11400000, guid: 9636b8e5400b0e8e38ae815274f65b69, type: 2}
reload: {fileID: 11400000, guid: b05fd0c6fbc99c1669a88d60100b83cc, type: 2}
projectileOrigin: {fileID: 4498264122734214993}
damageSource: {fileID: -6843496421257318028}
projectileLength: 76.9
layerMask:
serializedVersion: 2
m_Bits: 1
--- !u!114 &-6843496421257318028
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 492801038359376716}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5ac53e30c2f9ed3d48e3ed86a8aed11b, type: 3}
m_Name:
m_EditorClassIdentifier:
damage: 5
--- !u!4 &980965867932805622 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: bf9d862a19647f28795df2e666425003, type: 3}
m_PrefabInstance: {fileID: 727241450723970589}
m_PrefabAsset: {fileID: 0}

View file

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 16d8ce8164e4d9a59bd9c28737489417
DefaultImporter:
guid: 34383341362bbd7c59b199a69ed897e4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:

Binary file not shown.

View file

@ -0,0 +1,136 @@
fileFormatVersion: 2
guid: eb8ac924f016b1e33bcfd22c5db3b3e6
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
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:
- serializedVersion: 16
name: Head Hit
takeName: mixamo.com
internalID: -203655887218126122
firstFrame: 0
lastFrame: 28
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
hasAdditiveReferencePose: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 3
maskSource: {instanceID: 0}
additiveReferencePoseFrame: 0
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 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
strictVertexDataChecks: 0
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
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6d52e2f42c12ad4e7baa16ee84bbd922, type: 3}
m_Name: ActionMapValue
m_EditorClassIdentifier:
Description:
value:
value: 0

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c481c42e360ed2b89fb1f5fc4558fdb, type: 3}
m_Name: AttackInput
m_EditorClassIdentifier:
started: {fileID: 0}
performed: {fileID: 0}
canceled: {fileID: 0}
waiting: {fileID: 0}
disabled: {fileID: 0}
reactiveValue: {fileID: 0}
valueAsButton: {fileID: 11400000, guid: 9636b8e5400b0e8e38ae815274f65b69, type: 2}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2d5e43591ac8d995589100187bee292b, type: 3}
m_Name: AttackValue
m_EditorClassIdentifier:
Description:
value:
value: 0

View file

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

View file

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5090e65294fb8ff1a7d06242e9c7a1f, type: 3}
m_Name: CurrentControlSchemeValue
m_EditorClassIdentifier:
Description:

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 141143d4bbaccbcda8a23e106eed4b71, type: 3}
m_Name: LookInput
m_EditorClassIdentifier:
started: {fileID: 0}
performed: {fileID: 0}
canceled: {fileID: 0}
waiting: {fileID: 0}
disabled: {fileID: 0}
reactiveValue: {fileID: 11400000, guid: c70e76cde8eafc3beb7fcf9b0680f58a, type: 2}
valueAsButton: {fileID: 0}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a85afc7b5f9bc9f386e4f76d3725daf, type: 3}
m_Name: LookValue
m_EditorClassIdentifier:
Description:
value:
value: {x: 0, y: 0}

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c481c42e360ed2b89fb1f5fc4558fdb, type: 3}
m_Name: ReadyInput
m_EditorClassIdentifier:
started: {fileID: 0}
performed: {fileID: 0}
canceled: {fileID: 0}
waiting: {fileID: 0}
disabled: {fileID: 0}
reactiveValue: {fileID: 0}
valueAsButton: {fileID: 11400000, guid: 11f0f1ff4a0ab250ba395b772f722ffb, type: 2}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2d5e43591ac8d995589100187bee292b, type: 3}
m_Name: ReadyValue
m_EditorClassIdentifier:
Description:
value:
value: 0

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c481c42e360ed2b89fb1f5fc4558fdb, type: 3}
m_Name: ReloadInput
m_EditorClassIdentifier:
started: {fileID: 0}
performed: {fileID: 0}
canceled: {fileID: 0}
waiting: {fileID: 0}
disabled: {fileID: 0}
reactiveValue: {fileID: 0}
valueAsButton: {fileID: 11400000, guid: b05fd0c6fbc99c1669a88d60100b83cc, type: 2}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2d5e43591ac8d995589100187bee292b, type: 3}
m_Name: ReloadValue
m_EditorClassIdentifier:
Description:
value:
value: 0

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c481c42e360ed2b89fb1f5fc4558fdb, type: 3}
m_Name: UseSecondaryInput
m_EditorClassIdentifier:
started: {fileID: 0}
performed: {fileID: 0}
canceled: {fileID: 0}
waiting: {fileID: 0}
disabled: {fileID: 0}
reactiveValue: {fileID: 0}
valueAsButton: {fileID: 11400000, guid: 1b0b91e2eaf1545598f3f51dcebd45dc, type: 2}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2d5e43591ac8d995589100187bee292b, type: 3}
m_Name: UseSecondaryValue
m_EditorClassIdentifier:
Description:
value:
value: 0

View file

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

View file

@ -0,0 +1,24 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 113edbd3ab279ceccacd0762b2ff405f, type: 3}
m_Name: Pistol
m_EditorClassIdentifier:
id: 3aaccf06-f737-4e9b-9daf-2d99e69a14e7
displayName: Pistol
description:
icon: {fileID: -1451803064, guid: acf7be11a7aec869a96fca7c3cb2e6ff, type: 3}
tags: []
worldPrefab: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
previewPrefab: {fileID: 919132149155446097, guid: bf9d862a19647f28795df2e666425003, type: 3}
stackable: 0
maxStackCount: 1
equippedPrefab: {fileID: 492801038359376716, guid: 34383341362bbd7c59b199a69ed897e4, type: 3}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5418577a5e2be8f218e64364f8b64a5e, type: 3}
m_Name: PrimaryEquipment
m_EditorClassIdentifier:
Description:
value:
value: {fileID: 11400000, guid: 83a7512982c0868bbacfd587c15efbea, type: 2}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5418577a5e2be8f218e64364f8b64a5e, type: 3}
m_Name: SecondaryEquipment
m_EditorClassIdentifier:
Description:
value:
value: {fileID: 0}

View file

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

View file

@ -0,0 +1,23 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1ca5a6e9c022cf971a176095a74df394, type: 3}
m_Name: SelectedItem
m_EditorClassIdentifier:
id: 7602a606-109c-4a58-8786-f4c95fee7a92
displayName:
description:
icon: {fileID: 0}
tags: []
worldPrefab: {fileID: 0}
previewPrefab: {fileID: 0}
stackable: 0
maxStackCount: 1

View file

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

View file

@ -15,4 +15,6 @@ MonoBehaviour:
serializableItems:
- Item: {fileID: 11400000, guid: 3a9b5fc9b523890cf8abd310dbc64940, type: 2}
count: 1
capacity: 8
- Item: {fileID: 11400000, guid: 83a7512982c0868bbacfd587c15efbea, type: 2}
count: 1
capacity: 5

View file

@ -151,7 +151,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: d8894ba51a816c451b072d957a1cfe45, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 0c1a0528290b37272b20d94b19311768, type: 3}
sourceAsset: {fileID: 9197481963319205126, guid: 8cea95d71232d8469b296ca7eb59e0a1, type: 3}
m_SortingOrder: 0
m_WorldSpaceSizeMode: 1
m_WorldSpaceWidth: 1920
@ -180,10 +180,12 @@ MonoBehaviour:
m_GameObject: {fileID: 1223357529}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a819c4e399f6cc6c84ace2a31f18d56, type: 3}
m_Script: {fileID: 11500000, guid: b37256e37c5968be89fa34dd8344744f, type: 3}
m_Name:
m_EditorClassIdentifier:
uiDocument: {fileID: 1223357530}
doc: {fileID: 1223357530}
inventory: {fileID: 11400000, guid: cd3f9ac2afa71f8b6acb3fb0cacfe441, type: 2}
template: {fileID: 9197481963319205126, guid: 01b74a9c8f3685fb2880379892a17e46, type: 3}
--- !u!1 &1411077289
GameObject:
m_ObjectHideFlags: 0
@ -341,8 +343,8 @@ Camera:
m_GameObject: {fileID: 1889780342}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_ClearFlags: 2
m_BackGroundColor: {r: 1, g: 0.8726415, b: 0.986825, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using KitsuneCafe.Extension;
using KitsuneCafe.System.Attributes;
using KitsuneCafe.Sys.Attributes;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
@ -132,4 +132,4 @@ namespace KitsuneCafe.Editor
}
}
}
}
}

View file

@ -1,5 +1,5 @@
using System;
using KitsuneCafe.System.Attributes;
using KitsuneCafe.Sys.Attributes;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.UIElements;

View file

@ -1,8 +1,8 @@
using System;
using KitsuneCafe.System;
using KitsuneCafe.Sys;
using UnityEditor;
using UnityEngine.UIElements;
using TimeUnit = KitsuneCafe.System.TimeUnit;
using TimeUnit = KitsuneCafe.Sys.TimeUnit;
[CustomPropertyDrawer(typeof(Duration))]
public class DurationPropertyDrawer : PropertyDrawer

View file

@ -0,0 +1,110 @@
using System;
using KitsuneCafe.Extension;
using KitsuneCafe.Input;
using KitsuneCafe.ItemSystem;
using KitsuneCafe.SOAP;
using R3;
using UnityEngine;
namespace KitsuneCafe.Entity
{
public class AimFeature : MonoBehaviour
{
[SerializeField]
private new Camera camera;
[SerializeField]
private EquipmentInstance equipment;
[SerializeField]
private Motor motor;
[SerializeField]
private ControlSchemeValue controlScheme;
[SerializeField]
private Vector2Value lookValue;
private void OnValidate()
{
if (camera == null)
{
camera = Camera.main;
}
if (equipment == null)
{
equipment = GetComponent<EquipmentInstance>();
}
if (motor == null)
{
motor = GetComponent<Motor>();
}
}
private void Start()
{
var d = Disposable.CreateBuilder();
var readied = Observable.FromEventHandler<bool>(
e => equipment.Readied += e,
e => equipment.Readied -= e
)
.Select(static eh => eh.e);
readied
.Subscribe(isReady =>
{
motor.enabled = !isReady;
})
.AddTo(ref d);
readied
.WhereTrue()
.SelectMany(_ =>
controlScheme.AsObservable()
.CombineLatest(
Observable.IntervalFrame(1),
static (scheme, _) => scheme
).TakeUntil(readied.WhereFalse())
)
.Subscribe(Aim)
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
}
private void Aim(ControlScheme scheme)
{
switch (scheme)
{
case ControlScheme.Gamepad:
LookInDirection(lookValue.Value);
break;
default:
LookAtPosition(lookValue.Value);
break;
}
}
private void LookInDirection(Vector2 value)
{
transform.LookAt(transform.position + new Vector3(value.x, 0, value.y));
}
private void LookAtPosition(Vector2 value)
{
var screenPosition = camera.WorldToViewportPoint(transform.position);
var mouseOnScreen = camera.ScreenToViewportPoint(value);
float angle = AngleBetween(screenPosition, mouseOnScreen);
transform.rotation = Quaternion.Euler(new Vector3(0, -angle + 90, 0));
}
static float AngleBetween(Vector3 a, Vector3 b)
{
return Mathf.Atan2(b.y - a.y, b.x - a.x) * Mathf.Rad2Deg;
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8c1373e9dcadbfb4aa0bf837a1d44ce1

View file

@ -0,0 +1,15 @@
using UnityEngine;
namespace KitsuneCafe.Entity
{
public class BoneAttachment : MonoBehaviour
{
[SerializeField]
private Transform bone;
private void Start()
{
transform.SetParent(bone, false);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 795d0a02aa223804cb45ee88dd31f479

View file

@ -1,29 +1,37 @@
using KitsuneCafe.System;
using UnityEngine;
namespace KitsuneCafe.Entity
{
public interface IDamaging : IGameObject
{
void ApplyDamage(int amount, IDamageable target);
}
public interface IDamageable : IGameObject
{
void ReceiveDamage(IDamaging source, int amount);
}
public class DamageSource : MonoBehaviour, IDamaging
{
[SerializeField]
private int damage;
public void ApplyDamage(Collider target)
{
ApplyDamage(damage, target);
}
public void ApplyDamage(GameObject target)
{
ApplyDamage(damage, target);
}
public void ApplyDamage(IDamageable target)
{
ApplyDamage(damage, target);
}
public void ApplyDamage(int amount, IDamageable target)
{
target.ReceiveDamage(this, amount);
}
public void ApplyDamage(int amount, Collider target)
{
ApplyDamage(amount, target.gameObject);
}
public void ApplyDamage(int amount, GameObject target)
{
if (target.TryGetComponent(out IDamageable damageable))

View file

@ -0,0 +1,56 @@
using KitsuneCafe.Sys.Attributes;
using R3;
using UnityEngine;
namespace KitsuneCafe.Entity
{
public class DummyAnimator : MonoBehaviour
{
[SerializeField]
private Health health;
[SerializeField]
private Animator animator;
[SerializeField, AnimatorParam("animator")]
private int hitParam;
[SerializeField, AnimatorParam("animator")]
private int deathParam;
private void OnValidate()
{
if (animator == null)
{
animator = GetComponent<Animator>();
}
if (health == null)
{
health = GetComponent<Health>();
}
}
private void Start()
{
Observable.FromEventHandler<HealthChanged>(
e => health.HealthChanged += e,
e => health.HealthChanged -= e
)
.Select(ev => ev.e)
.Subscribe(e =>
{
if (e.Current > 0)
{
animator.SetBool(hitParam, true);
}
else
{
animator.SetBool(deathParam, true);
}
})
.AddTo(this);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 452b09482ed36cc83ab8817f704c9acd

View file

@ -1,8 +1,9 @@
using KitsuneCafe.Extension;
using KitsuneCafe.ItemSystem;
using KitsuneCafe.Sys;
using KitsuneCafe.Sys.Attributes;
using R3;
using UnityEngine;
using KitsuneCafe.System;
using KitsuneCafe.Extension;
using KitsuneCafe.System.Attributes;
namespace KitsuneCafe.Entity
{
@ -16,6 +17,7 @@ namespace KitsuneCafe.Entity
[SerializeField]
private new Rigidbody rigidbody;
[Header("Movement")]
[SerializeField]
private Motor motor;
@ -37,15 +39,39 @@ namespace KitsuneCafe.Entity
[SerializeField, Range(0f, 1f)]
private float sprintAnimationParamMax = 1.0f;
[Header("Combat")]
[SerializeField, AnimatorParam("animator")]
private string readyParam;
private void Reset()
[SerializeField]
private EquipmentInstance equipment;
private void OnValidate()
{
animator = GetComponent<Animator>();
rigidbody = GetComponent<Rigidbody>();
motor = GetComponent<Motor>();
sprint = GetComponent<SprintFeature>();
if (animator == null)
{
animator = GetComponent<Animator>();
}
if (rigidbody == null)
{
rigidbody = GetComponent<Rigidbody>();
}
if (motor == null)
{
motor = GetComponent<Motor>();
}
if (sprint == null)
{
sprint = GetComponent<SprintFeature>();
}
if (equipment == null)
{
equipment = GetComponent<EquipmentInstance>();
}
}
private void Awake()
@ -73,6 +99,15 @@ namespace KitsuneCafe.Entity
})
.AddTo(ref d);
Observable.FromEventHandler<bool>(
e => equipment.Readied += e,
e => equipment.Readied -= e
)
.Select(eh => eh.e)
.Subscribe(ready => animator.SetBool(readyParam, ready))
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
}
@ -110,4 +145,4 @@ namespace KitsuneCafe.Entity
}
}
}
}
}

View file

@ -4,6 +4,13 @@ using UnityEngine;
namespace KitsuneCafe.Entity
{
public record HealthChanged(int Previous, int Current)
{
public static implicit operator HealthChanged((int, int) t) => new(t.Item1, t.Item2);
public static implicit operator (int Previous, int Current)(HealthChanged t) =>
(t.Previous, t.Current);
}
public class Health : MonoBehaviour, IDamageable
{
[SerializeField]
@ -16,14 +23,31 @@ namespace KitsuneCafe.Entity
public int Current => current.CurrentValue;
[SerializeField]
private bool restoreOnStart = true;
public event EventHandler<HealthChanged> HealthChanged;
private void Start()
{
if (restoreOnStart)
{
current.Value = max.Value;
}
current.AsObservable()
.Pairwise()
.Subscribe(t => HealthChanged?.Invoke(this, t));
}
public void Recover(int amount)
{
this.current.Value = Math.Clamp(this.Current + amount, 0, this.Max);
current.Value = Math.Clamp(Current + amount, 0, Max);
}
public void ReceiveDamage(IDamaging source, int amount)
{
this.current.Value = Math.Clamp(this.Current - amount, 0, this.Max);
current.Value = Math.Clamp(Current - amount, 0, Max);
}
}
}

View file

@ -0,0 +1,9 @@
using KitsuneCafe.Sys;
namespace KitsuneCafe.Entity
{
public interface IDamageable : IGameObject
{
void ReceiveDamage(IDamaging source, int amount);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0a4a01d5c978b1cf8afe37f7e19f4b67

View file

@ -0,0 +1,9 @@
using KitsuneCafe.Sys;
namespace KitsuneCafe.Entity
{
public interface IDamaging : IGameObject
{
void ApplyDamage(int amount, IDamageable target);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8a298d4067ebae12aa214a267d09879b

View file

@ -1,3 +1,4 @@
using System.Threading;
using KitsuneCafe.Extension;
using KitsuneCafe.SOAP;
using R3;
@ -39,19 +40,23 @@ namespace KitsuneCafe.Entity
private float epsilon = 0.001f;
private float sqEpsilon;
private ReactiveProperty<float> currentMaxSpeed = new ReactiveProperty<float>();
private ReactiveProperty<float> currentMaxSpeed = new();
public float MaxSpeed => currentMaxSpeed.Value;
public ReactiveProperty<float> MaxSpeedSource => currentMaxSpeed;
//private readonly ReactiveProperty<Vector3> direction = new ReactiveProperty<Vector3>(Vector3.zero);
private CancellationTokenSource disableCancellationSource;
private void Reset()
private void OnValidate()
{
rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = GetComponent<Rigidbody>();
}
}
private void Awake()
private void OnEnable()
{
disableCancellationSource = new();
var directionSource = direction.AsObservable().Select(v2 => new Vector3(v2.x, 0, v2.y));
currentMaxSpeed.Value = maxSpeed;
@ -77,7 +82,13 @@ namespace KitsuneCafe.Entity
})
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
d.RegisterTo(disableCancellationSource.Token);
}
private void OnDisable()
{
rigidbody.linearVelocity = Vector3.zero;
disableCancellationSource.Cancel();
}
private Observable<Quaternion> CalculateRotationStream(Observable<Vector3> directionSource, FrameProvider provider)

View file

@ -16,7 +16,7 @@ namespace KitsuneCafe.Entity
private float adjustedMaxSpeed = 3f;
public float SprintSpeed => adjustedMaxSpeed;
public readonly ReactiveProperty<bool> IsSprinting = new ReactiveProperty<bool>(false);
public readonly ReactiveProperty<bool> IsSprinting = new(false);
private void Reset()
{

View file

@ -1,4 +1,4 @@
using KitsuneCafe.System.Attributes;
using KitsuneCafe.Sys.Attributes;
using UnityEngine;
namespace KitsuneCafe.Animation
@ -85,4 +85,4 @@ namespace KitsuneCafe.Animation
Trigger(parameter);
}
}
}
}

View file

@ -1,9 +1,22 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KitsuneCafe.Extension
{
public static class CollectionExtension
{
public static bool HasIndex(this IList list, int index)
{
return index >= 0 && index < list.Count;
}
public static IEnumerable<(T, int)> Enumerate<T>(this IEnumerable<T> enumerable)
{
return enumerable.Select((x, i) => (x, i));
}
public static bool IsTypeOf<T, U>()
{
return IsTypeOf(typeof(T), typeof(U));

View file

@ -1,9 +1,9 @@
using R3;
using UnityEngine;
using System;
using KitsuneCafe.System;
using System.Collections.Generic;
using System.Threading;
using KitsuneCafe.Sys;
using R3;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace KitsuneCafe.Extension
@ -179,6 +179,11 @@ namespace KitsuneCafe.Extension
return source.Where(Func.Identity);
}
public static Observable<bool> WhereFalse(this Observable<bool> source)
{
return WhereEquals(source, false);
}
public static Observable<T> ObserveBool<T>(this T component, Func<T, bool> predicate) where T : MonoBehaviour
{
if (predicate(component))

View file

@ -0,0 +1,8 @@
namespace KitsuneCafe.Input
{
public enum ActionMap
{
Player,
UI
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0c363f3d399e01d6ab6b10234746c96a

View file

@ -0,0 +1,72 @@
using KitsuneCafe.SOAP;
using R3;
using UnityEngine;
using UnityEngine.InputSystem;
namespace KitsuneCafe.Input
{
public class InputChangeHandler : MonoBehaviour
{
[SerializeField]
private PlayerInput playerInput;
[SerializeField]
private ControlSchemeValue controlScheme;
[SerializeField]
private ActionMapValue actionMap;
private void OnValidate()
{
if (playerInput == null)
{
playerInput = GetComponent<PlayerInput>();
}
}
private void Start()
{
var d = Disposable.CreateBuilder();
actionMap.AsObservable()
.DistinctUntilChanged()
.Subscribe(map =>
{
var name = map switch
{
ActionMap.Player => "Player",
ActionMap.UI => "UI",
_ => throw new System.NotImplementedException()
};
var inputActionMap = playerInput.actions.FindActionMap(name);
playerInput.currentActionMap = inputActionMap;
})
.AddTo(ref d);
controlScheme.Value = GetControlScheme(playerInput.currentControlScheme);
Observable.FromEvent<PlayerInput>(
e => playerInput.onControlsChanged += e,
e => playerInput.onControlsChanged -= e
)
.Subscribe(value =>
{
controlScheme.Value = GetControlScheme(value.currentControlScheme);
})
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
}
private static ControlScheme GetControlScheme(string controlScheme)
{
return controlScheme switch
{
"Gamepad" => ControlScheme.Gamepad,
"Keyboard&Mouse" => ControlScheme.KeyboardAndMouse,
_ => ControlScheme.Other
};
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 833c47d8284ff8354ba97485ed999d8e

View file

@ -0,0 +1,9 @@
namespace KitsuneCafe.Input
{
public enum ControlScheme
{
Gamepad,
KeyboardAndMouse,
Other
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5df883635b91c2a58acc85689ffbf0da

View file

@ -1,7 +1,7 @@
using System;
using KitsuneCafe.ItemSystem;
using KitsuneCafe.System;
using KitsuneCafe.System.Attributes;
using KitsuneCafe.Sys;
using KitsuneCafe.Sys.Attributes;
using UnityEngine;
using UnityEngine.Events;

View file

@ -1,5 +1,5 @@
using System;
using KitsuneCafe.System;
using KitsuneCafe.Sys;
using UnityEngine;
namespace KitsuneCafe.Interaction
@ -74,9 +74,9 @@ namespace KitsuneCafe.Interaction
{
public static class Result
{
public static IResult<Unit, InteractionError> Ok() => System.Result.Ok<Unit, InteractionError>(default);
public static IResult<Unit, InteractionError> Err(InteractionError error) => System.Result.Err<Unit, InteractionError>(error);
public static IResult<Unit, InteractionError> Err(InteractionErrorCode error) => System.Result.Err<Unit, InteractionError>(error);
public static IResult<Unit, InteractionError> Ok() => Sys.Result.Ok<Unit, InteractionError>(default);
public static IResult<Unit, InteractionError> Err(InteractionError error) => Sys.Result.Err<Unit, InteractionError>(error);
public static IResult<Unit, InteractionError> Err(InteractionErrorCode error) => Sys.Result.Err<Unit, InteractionError>(error);
}
bool IsInteractable { get; }
@ -86,4 +86,4 @@ namespace KitsuneCafe.Interaction
IResult<Unit, InteractionError> Interact(IInteractor interactor);
}
}
}

View file

@ -1,4 +1,4 @@
using KitsuneCafe.System;
using KitsuneCafe.Sys;
using UnityEngine;
using UnityEngine.Events;

View file

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using KitsuneCafe.SOAP;
using KitsuneCafe.Sys.Attributes;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public abstract class BaseItem : ScriptableObject, IItem
{
[SerializeField]
private string id;
public string Id => id;
[SerializeField]
private string displayName;
public string DisplayName => displayName;
[SerializeField, TextArea]
private string description;
public string Description => description;
[SerializeField]
private Sprite icon;
public Sprite Icon => icon;
[SerializeField]
private List<StringConstant> tags;
public IReadOnlyCollection<StringConstant> Tags => tags;
[SerializeField]
private GameObject worldPrefab;
[SerializeField]
private GameObject previewPrefab;
[Button("Generate New ID")]
protected void GenerateNewId()
{
id = Guid.NewGuid().ToString();
#if UNITY_EDITOR
UnityEditor.EditorUtility.SetDirty(this);
#endif
}
public GameObject CreateInstance()
{
return Instantiate(worldPrefab);
}
public GameObject CreatePreview()
{
return Instantiate(previewPrefab);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 38f485775f9f15e6f9d9dd3874bd6bef

View file

@ -0,0 +1,111 @@
using System;
using KitsuneCafe.Entity;
using KitsuneCafe.SOAP;
using R3;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public record ChangedEquipmentEvent(IEquippable Previous, IEquippable Current);
public class EquipmentInstance : MonoBehaviour
{
[SerializeField]
private InventoryInstance inventory;
[SerializeField]
private BoneAttachment attachment;
[SerializeField]
private EquipmentValue primary;
public EquipmentItem Primary => primary.Value;
[SerializeField]
private EquipmentValue secondary;
public EquipmentItem Secondary => secondary.Value;
private IEquippable equippedPrimary;
public event EventHandler<ChangedEquipmentEvent> ChangedEquipment;
public event EventHandler<bool> Readied;
public event EventHandler Attacked;
public event EventHandler Reloaded;
public bool HasPrimaryEquipped => primary != null;
public bool HasSecondaryEquipped => secondary != null;
private void OnValidate()
{
if (inventory == null)
{
inventory = GetComponent<InventoryInstance>();
}
if (attachment == null)
{
attachment = GetComponent<BoneAttachment>();
}
}
private void Start()
{
var d = Disposable.CreateBuilder();
primary.AsObservable()
.Subscribe(EquipPrimary)
.AddTo(ref d);
secondary.AsObservable()
.Subscribe()
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
}
private void EquipPrimary(EquipmentItem equipment)
{
var previous = equippedPrimary;
if (equippedPrimary != null)
{
equippedPrimary.OnUnequip();
equippedPrimary.Readied -= OnReady;
equippedPrimary.Attacked -= OnAttack;
equippedPrimary.Reloaded -= OnReload;
Destroy(equippedPrimary.gameObject);
equippedPrimary = null;
}
IEquippable instance = null;
if (equipment != null)
{
instance = equipment.CreateEquipment();
instance.Readied += OnReady;
instance.Attacked += OnAttack;
instance.Reloaded += OnReload;
instance.gameObject.transform.SetParent(attachment.transform, false);
equippedPrimary = instance;
equippedPrimary.OnEquip(inventory);
}
ChangedEquipment?.Invoke(this, new ChangedEquipmentEvent(previous, instance));
}
private void OnReload(object sender, EventArgs e)
{
Reloaded?.Invoke(sender, e);
}
private void OnAttack(object sender, EventArgs e)
{
Attacked?.Invoke(sender, e);
}
private void OnReady(object sender, bool e)
{
Readied?.Invoke(sender, e);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d5ed1241db3bd1d74899513f3875cbe1

View file

@ -0,0 +1,27 @@
using KitsuneCafe.Sys;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
[CreateAssetMenu(menuName = KitsuneCafeMenu.Item + "Equipment")]
public class EquipmentItem : Item, IEquipmentItem
{
[SerializeField]
private GameObject equippedPrefab;
public GameObject EquippedPrefab => equippedPrefab;
private void OnValidate()
{
if (equippedPrefab != null && equippedPrefab.GetComponent<IEquippable>() == null)
{
Debug.LogWarning($"Equipment prefab {equippedPrefab} has no instance of IEquipment.");
equippedPrefab = null;
}
}
public IEquippable CreateEquipment()
{
return Instantiate(equippedPrefab).GetComponent<IEquippable>();
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 113edbd3ab279ceccacd0762b2ff405f

View file

@ -0,0 +1,126 @@
using System;
using KitsuneCafe.Entity;
using KitsuneCafe.Extension;
using KitsuneCafe.SOAP;
using R3;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public class Firearm : MonoBehaviour, IEquippable, IDamaging
{
[SerializeField]
private BoolValue ready;
[SerializeField]
private BoolValue fire;
[SerializeField]
private BoolValue reload;
[SerializeField]
private Transform projectileOrigin;
[SerializeField]
private DamageSource damageSource;
[SerializeField]
private float projectileLength = 15;
[SerializeField]
private LayerMask layerMask;
public event EventHandler<bool> Readied;
public event EventHandler Attacked;
public event EventHandler Reloaded;
private InventoryInstance inventory;
private readonly RaycastHit[] hits = new RaycastHit[1];
private void OnValidate()
{
if (damageSource == null)
{
damageSource = GetComponent<DamageSource>();
}
}
public void OnEquip(InventoryInstance inventory)
{
this.inventory = inventory;
}
public void OnUnequip() { }
private void Start()
{
if (projectileOrigin == null)
{
projectileOrigin = transform;
}
var d = Disposable.CreateBuilder();
ready
.AsObservable()
.Subscribe(Ready)
.AddTo(ref d);
fire
.AsObservable()
.CombineLatest(ready.AsObservable(), (ready, fire) => ready && fire)
.WhereTrue()
.AsUnitObservable()
.Subscribe(_ => Fire())
.AddTo(ref d);
reload
.AsObservable()
.WhereTrue()
.Subscribe(_ => Reload())
.AddTo(ref d);
d.RegisterTo(destroyCancellationToken);
}
private void Ready(bool isReady)
{
Readied?.Invoke(this, isReady);
}
private void Fire()
{
var count = Physics.RaycastNonAlloc(
projectileOrigin.position,
projectileOrigin.forward,
hits,
projectileLength,
layerMask
);
if (count > 0)
{
damageSource.ApplyDamage(hits[0].collider);
}
Attacked?.Invoke(this, EventArgs.Empty);
}
private void Reload()
{
Reloaded?.Invoke(this, EventArgs.Empty);
Debug.Log("rewowd");
}
public void ApplyDamage(int amount, IDamageable target)
{
damageSource.ApplyDamage(amount, target);
}
private void OnDrawGizmos()
{
Gizmos.color = Color.red;
Gizmos.DrawRay(projectileOrigin.position, projectileOrigin.forward * projectileLength);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a9bef8fb859e614a48357ece1c529698

View file

@ -0,0 +1,16 @@
using System;
using KitsuneCafe.Sys;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public interface IEquippable : IGameObject
{
event EventHandler<bool> Readied;
event EventHandler Attacked;
event EventHandler Reloaded;
void OnEquip(InventoryInstance inventory);
void OnUnequip();
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: acdd766073e954e45bace8b1d7d69a88

View file

@ -0,0 +1,9 @@
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public interface IEquipmentItem : IItem
{
GameObject EquippedPrefab { get; }
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a8915224351f977c8b65a98baf25b5e6

View file

@ -0,0 +1,15 @@
using System.Collections.Generic;
using KitsuneCafe.SOAP;
using UnityEngine;
namespace KitsuneCafe.ItemSystem
{
public interface IItem
{
string Id { get; }
string DisplayName { get; }
string Description { get; }
Sprite Icon { get; }
IReadOnlyCollection<StringConstant> Tags { get; }
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 470c7308b27c9451eaa2f30b663e15ca

View file

@ -0,0 +1,7 @@
namespace KitsuneCafe.ItemSystem
{
public interface IStackable
{
int MaxStackCount { get; }
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4fb21fae91cb26c0d89fabf2cb3b9642

View file

@ -1,309 +1,357 @@
using System;
using System.Collections;
using System.Collections.Generic;
using KitsuneCafe.System;
using KitsuneCafe.Sys;
using ObservableCollections;
using UnityEngine;
using Unit = KitsuneCafe.System.Unit;
using Unit = KitsuneCafe.Sys.Unit;
namespace KitsuneCafe.ItemSystem
{
[Serializable]
public struct InventoryItem : IEquatable<Item>, ICountable
[Serializable]
public struct InventoryItem : IEquatable<Item>, ICountable
{
public Item Item;
[SerializeField]
private int count;
public readonly int Count => count;
private InventoryItem(Item item, int count)
{
public Item Item;
[SerializeField]
private int count;
public readonly int Count => count;
private InventoryItem(Item item, int count)
{
Item = item;
this.count = count;
}
public static int Create(Item item, int count, out InventoryItem? inventoryItem)
{
int quantity = Math.Clamp(count, 0, item.MaxStackCount);
inventoryItem = quantity > 0 ? new InventoryItem(item, quantity) : null;
return quantity;
}
public readonly int IncreaseCount(int count, out InventoryItem? item)
{
return Create(Item, Count + count, out item);
}
public readonly int ReduceCount(int count, out InventoryItem? item)
{
return Create(Item, Count - count, out item);
}
public readonly bool Equals(Item other)
{
return Item == other;
}
public override readonly bool Equals(object obj)
{
return obj is InventoryItem other
&& Item == other.Item
&& Count == other.Count;
}
public override int GetHashCode()
{
return HashCode.Combine(Item, Count);
}
Item = item;
this.count = count;
}
public enum InventoryError
public static int Create(Item item, int count, out InventoryItem? inventoryItem)
{
None,
InventoryFull,
ItemNotFound,
NotEnoughQuantity,
ItemNotStackable,
InvalidQuantity
int quantity = Math.Clamp(count, 0, item.MaxStackCount);
inventoryItem = quantity > 0 ? new InventoryItem(item, quantity) : null;
return quantity;
}
public interface ICountable
public readonly int IncreaseCount(int count, out InventoryItem? item)
{
int Count { get; }
return Create(Item, Count + count, out item);
}
public interface IInventory<T> where T : IEquatable<Item>, ICountable
public readonly int ReduceCount(int count, out InventoryItem? item)
{
int Capacity { get; }
int Count { get; }
IResult<Unit, InventoryError> Add(Item item, int count = 1);
IResult<Unit, InventoryError> Remove(Item item, int count = 1);
IEnumerable<T> Find(Func<T, bool> predicate);
bool Has(Item item);
return Create(Item, Count - count, out item);
}
[CreateAssetMenu(menuName = KitsuneCafeMenu.Item + "Inventory")]
public class Inventory : ScriptableObject, IInventory<InventoryItem>, IEnumerable<InventoryItem>, IObservableCollection<InventoryItem>, ISerializationCallbackReceiver
public readonly bool Equals(Item other)
{
[SerializeField]
private List<InventoryItem> serializableItems = new();
return Item == other;
}
private ObservableList<InventoryItem> runtimeItems;
public override readonly bool Equals(object obj)
{
return obj is InventoryItem other
&& Item == other.Item
&& Count == other.Count;
}
[SerializeField]
private int capacity = 8;
public override int GetHashCode()
{
return HashCode.Combine(Item, Count);
}
}
public event NotifyCollectionChangedEventHandler<InventoryItem> CollectionChanged = default;
public enum InventoryError
{
None,
InventoryFull,
ItemNotFound,
NotEnoughQuantity,
ItemNotStackable,
InvalidQuantity
}
public int Capacity => capacity;
public interface ICountable
{
int Count { get; }
}
public int Count => runtimeItems?.Count ?? 0;
public interface IInventory<T> where T : IEquatable<Item>, ICountable
{
int Capacity { get; }
int Count { get; }
public bool IsEmpty => Count == 0;
public bool IsFull => Count == Capacity;
IResult<Unit, InventoryError> Add(Item item, int count = 1);
IResult<Unit, InventoryError> Remove(Item item, int count = 1);
IEnumerable<T> Find(Func<T, bool> predicate);
bool Has(Item item);
}
public object SyncRoot => runtimeItems.SyncRoot;
[CreateAssetMenu(menuName = KitsuneCafeMenu.Item + "Inventory")]
public class Inventory : ScriptableObject, IList, IInventory<InventoryItem>, IEnumerable<InventoryItem>, IObservableCollection<InventoryItem>, ISerializationCallbackReceiver
{
[SerializeField]
private List<InventoryItem> serializableItems = new();
public InventoryItem this[int index]
private ObservableList<InventoryItem> runtimeItems;
[SerializeField]
private int capacity = 8;
public event NotifyCollectionChangedEventHandler<InventoryItem> CollectionChanged = default;
public int Capacity => capacity;
public int Count => runtimeItems?.Count ?? 0;
public bool IsEmpty => Count == 0;
public bool IsFull => Count == Capacity;
public object SyncRoot => runtimeItems.SyncRoot;
public bool IsFixedSize => ((IList)runtimeItems).IsFixedSize;
public bool IsReadOnly => ((IList)runtimeItems).IsReadOnly;
public bool IsSynchronized => ((ICollection)runtimeItems).IsSynchronized;
object IList.this[int index] { get => runtimeItems[index]; set => runtimeItems[index] = (InventoryItem)value; }
public InventoryItem this[int index]
{
get => runtimeItems[index];
set => runtimeItems[index] = value;
}
private void OnEnable()
{
if (runtimeItems == null)
{
runtimeItems = new ObservableList<InventoryItem>();
}
runtimeItems.CollectionChanged -= OnCollectionChanged;
runtimeItems.CollectionChanged += OnCollectionChanged;
}
private void OnDisable()
{
if (runtimeItems != null)
{
runtimeItems.CollectionChanged -= OnCollectionChanged;
}
}
private void OnCollectionChanged(in NotifyCollectionChangedEventArgs<InventoryItem> e)
{
CollectionChanged?.Invoke(e);
}
public void OnBeforeSerialize()
{
if (runtimeItems != null)
{
serializableItems.Clear();
foreach (var item in runtimeItems)
{
get => runtimeItems[index];
set => runtimeItems[index] = value;
serializableItems.Add(item);
}
}
}
public void OnAfterDeserialize()
{
if (runtimeItems == null)
{
runtimeItems = new ObservableList<InventoryItem>();
}
else
{
runtimeItems.Clear();
}
foreach (var item in serializableItems)
{
runtimeItems.Add(item);
}
}
public IEnumerable<InventoryItem> Find(Func<InventoryItem, bool> predicate)
{
for (int i = 0; i < Count; i++)
{
var item = runtimeItems[i];
if (predicate(item))
{
yield return item;
}
}
}
private IResult<int, InventoryError> AddToExisting(Item item, int count)
{
if (count <= 0)
{
return Result.Err<int, InventoryError>(InventoryError.InvalidQuantity);
}
for (int i = 0; i < Count; i++)
{
var existingItem = runtimeItems[i];
if (existingItem.Equals(item))
{
if (!item.IsStackable)
{
return Result.Err<int, InventoryError>(InventoryError.ItemNotStackable);
}
var consumedAmount = existingItem.IncreaseCount(count, out var updatedItem);
runtimeItems[i] = updatedItem.Value;
count -= consumedAmount;
if (count <= 0)
{
return Result.Ok<int, InventoryError>(0);
}
}
}
return Result.Ok<int, InventoryError>(count);
}
private IResult<Unit, InventoryError> AddNew(Item item, int count)
{
while (count > 0)
{
if (IsFull)
{
return Result.Err<Unit, InventoryError>(InventoryError.InventoryFull);
}
private void OnEnable()
count -= InventoryItem.Create(item, count, out var newItem);
runtimeItems.Add(newItem.Value);
}
return Result.Ok<Unit, InventoryError>(default);
}
public IResult<Unit, InventoryError> Add(Item item, int count = 1)
{
return AddToExisting(item, count)
.Where(count => count > 0)
.SelectMany(count => AddNew(item, count)) switch
{
Ok<Unit, InventoryError> ok => ok,
Err<Unit, InventoryError>(InventoryError.None) => Result.Ok<Unit, InventoryError>(default),
var err => err
};
}
public IResult<Unit, InventoryError> Remove(Item item, int count = 1)
{
if (count <= 0)
{
return Result.Err<Unit, InventoryError>(InventoryError.InvalidQuantity);
}
for (int i = runtimeItems.Count - 1; i >= 0; i--)
{
var existingItem = runtimeItems[i];
if (existingItem.Item == item)
{
if (runtimeItems == null)
{
runtimeItems = new ObservableList<InventoryItem>();
}
runtimeItems.CollectionChanged -= OnCollectionChanged;
runtimeItems.CollectionChanged += OnCollectionChanged;
}
private void OnDisable()
{
if (runtimeItems != null)
{
runtimeItems.CollectionChanged -= OnCollectionChanged;
}
}
private void OnCollectionChanged(in NotifyCollectionChangedEventArgs<InventoryItem> e)
{
CollectionChanged?.Invoke(e);
}
public void OnBeforeSerialize()
{
if (runtimeItems != null)
{
serializableItems.Clear();
foreach (var item in runtimeItems)
{
serializableItems.Add(item);
}
}
}
public void OnAfterDeserialize()
{
if (runtimeItems == null)
{
runtimeItems = new ObservableList<InventoryItem>();
}
else
{
runtimeItems.Clear();
}
foreach (var item in serializableItems)
{
runtimeItems.Add(item);
}
}
public IEnumerable<InventoryItem> Find(Func<InventoryItem, bool> predicate)
{
for (int i = 0; i < Count; i++)
{
var item = runtimeItems[i];
if (predicate(item))
{
yield return item;
}
}
}
private IResult<int, InventoryError> AddToExisting(Item item, int count)
{
if (count <= 0)
{
return Result.Err<int, InventoryError>(InventoryError.InvalidQuantity);
}
for (int i = 0; i < Count; i++)
{
var existingItem = runtimeItems[i];
if (existingItem.Equals(item))
{
if (!item.IsStackable)
{
return Result.Err<int, InventoryError>(InventoryError.ItemNotStackable);
}
var consumedAmount = existingItem.IncreaseCount(count, out var updatedItem);
runtimeItems[i] = updatedItem.Value;
count -= consumedAmount;
if (count <= 0)
{
return Result.Ok<int, InventoryError>(0);
}
}
}
return Result.Ok<int, InventoryError>(count);
}
private IResult<Unit, InventoryError> AddNew(Item item, int count)
{
while (count > 0)
{
if (IsFull)
{
return Result.Err<Unit, InventoryError>(InventoryError.InventoryFull);
}
count -= InventoryItem.Create(item, count, out var newItem);
runtimeItems.Add(newItem.Value);
}
return Result.Ok<Unit, InventoryError>(default);
}
public IResult<Unit, InventoryError> Add(Item item, int count = 1)
{
return AddToExisting(item, count)
.Where(count => count > 0)
.SelectMany(count => AddNew(item, count)) switch
{
Ok<Unit, InventoryError> ok => ok,
Err<Unit, InventoryError>(InventoryError.None) => Result.Ok<Unit, InventoryError>(default),
var err => err
};
}
public IResult<Unit, InventoryError> Remove(Item item, int count = 1)
{
if (count <= 0)
{
return Result.Err<Unit, InventoryError>(InventoryError.InvalidQuantity);
}
for (int i = runtimeItems.Count - 1; i >= 0; i--)
{
var existingItem = runtimeItems[i];
if (existingItem.Item == item)
{
if (existingItem.Count > count)
{
existingItem.ReduceCount(count, out var updatedItem);
runtimeItems[i] = updatedItem.Value;
return Result.Ok<Unit, InventoryError>(Unit.Default);
}
else
{
count -= existingItem.Count;
runtimeItems.RemoveAt(i);
if (count == 0)
{
return Result.Ok<Unit, InventoryError>(Unit.Default);
}
}
}
}
if (count > 0)
{
return Result.Err<Unit, InventoryError>(InventoryError.NotEnoughQuantity);
}
if (existingItem.Count > count)
{
existingItem.ReduceCount(count, out var updatedItem);
runtimeItems[i] = updatedItem.Value;
return Result.Ok<Unit, InventoryError>(Unit.Default);
}
}
else
{
count -= existingItem.Count;
runtimeItems.RemoveAt(i);
public bool Has(Item item)
{
for (int i = 0; i < Count; i++)
if (count == 0)
{
if (runtimeItems[i].Equals(item))
{
return true;
}
return Result.Ok<Unit, InventoryError>(Unit.Default);
}
return false;
}
}
}
public IEnumerator<InventoryItem> GetEnumerator()
{
return runtimeItems.GetEnumerator();
}
if (count > 0)
{
return Result.Err<Unit, InventoryError>(InventoryError.NotEnoughQuantity);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public ISynchronizedView<InventoryItem, TView> CreateView<TView>(Func<InventoryItem, TView> transform)
{
return runtimeItems.CreateView(transform);
}
return Result.Ok<Unit, InventoryError>(Unit.Default);
}
public bool Has(Item item)
{
for (int i = 0; i < Count; i++)
{
if (runtimeItems[i].Equals(item))
{
return true;
}
}
return false;
}
public IEnumerator<InventoryItem> GetEnumerator()
{
return runtimeItems.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public ISynchronizedView<InventoryItem, TView> CreateView<TView>(Func<InventoryItem, TView> transform)
{
return runtimeItems.CreateView(transform);
}
public int Add(object value)
{
return ((IList)runtimeItems).Add(value);
}
public void Clear()
{
((IList)runtimeItems).Clear();
}
public bool Contains(object value)
{
return ((IList)runtimeItems).Contains(value);
}
public int IndexOf(object value)
{
return ((IList)runtimeItems).IndexOf(value);
}
public void Insert(int index, object value)
{
((IList)runtimeItems).Insert(index, value);
}
public void Remove(object value)
{
((IList)runtimeItems).Remove(value);
}
public void RemoveAt(int index)
{
((IList)runtimeItems).RemoveAt(index);
}
public void CopyTo(Array array, int index)
{
((ICollection)runtimeItems).CopyTo(array, index);
}
}
}

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using KitsuneCafe.System;
using KitsuneCafe.Sys;
using UnityEngine;
namespace KitsuneCafe.ItemSystem

Some files were not shown because too many files have changed in this diff Show more