diff --git a/Assets/Images/Player/Animation/Player.controller b/Assets/Images/Player/Animation/Player.controller index ce79651..6a554d0 100644 --- a/Assets/Images/Player/Animation/Player.controller +++ b/Assets/Images/Player/Animation/Player.controller @@ -9,8 +9,14 @@ m_Name: m_Conditions: - m_ConditionMode: 1 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 + - m_ConditionMode: 3 + m_ConditionEvent: Velocity + m_EventTreshold: 0.1 + - m_ConditionMode: 4 + m_ConditionEvent: Velocity + m_EventTreshold: -0.1 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -6880058234535011538} m_Solo: 0 @@ -37,6 +43,7 @@ m_CycleOffset: 0 m_Transitions: - {fileID: 1251318347272487358} + - {fileID: -349146007674686353} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -88,18 +95,15 @@ m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 3 - m_ConditionEvent: moveX - m_EventTreshold: -0.1 + - m_ConditionMode: 2 + m_ConditionEvent: IsAttacking + m_EventTreshold: 0 - m_ConditionMode: 4 - m_ConditionEvent: moveX + m_ConditionEvent: Velocity m_EventTreshold: 0.1 - m_ConditionMode: 3 m_ConditionEvent: moveY m_EventTreshold: -0.1 - - m_ConditionMode: 4 - m_ConditionEvent: moveY - m_EventTreshold: 0.1 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -3840155598129999333} m_Solo: 0 @@ -181,11 +185,8 @@ m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 3 - m_ConditionEvent: LastMoveX - m_EventTreshold: 0.1 - m_ConditionMode: 1 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -6880058234535011538} @@ -201,6 +202,37 @@ m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &-349146007674686353 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 2 + m_ConditionEvent: IsAttacking + m_EventTreshold: 0 + - m_ConditionMode: 3 + m_ConditionEvent: Velocity + m_EventTreshold: 0.1 + - m_ConditionMode: 4 + m_ConditionEvent: Velocity + m_EventTreshold: -0.1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 3452964147490479734} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.42307693 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &-25492061600449708 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -240,31 +272,37 @@ m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: moveY m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: LastMoveX m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: LastMoveY m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} - - m_Name: isAttacking + m_Controller: {fileID: 0} + - m_Name: IsAttacking m_Type: 4 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} + - m_Name: Velocity + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -287,8 +325,14 @@ m_Name: m_Conditions: - m_ConditionMode: 2 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 + - m_ConditionMode: 4 + m_ConditionEvent: Velocity + m_EventTreshold: 0.1 + - m_ConditionMode: 3 + m_ConditionEvent: Velocity + m_EventTreshold: -0.1 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -3840155598129999333} m_Solo: 0 @@ -298,7 +342,7 @@ m_TransitionDuration: 0 m_TransitionOffset: 0 m_ExitTime: 0.42307693 - m_HasExitTime: 0 + m_HasExitTime: 1 m_HasFixedDuration: 0 m_InterruptionSource: 0 m_OrderedInterruption: 1 @@ -534,7 +578,7 @@ m_ConditionEvent: LastMoveY m_EventTreshold: 0.1 - m_ConditionMode: 1 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -6880058234535011538} @@ -562,7 +606,7 @@ m_ConditionEvent: LastMoveX m_EventTreshold: -0.1 - m_ConditionMode: 1 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -6880058234535011538} @@ -590,7 +634,7 @@ m_ConditionEvent: LastMoveY m_EventTreshold: -0.1 - m_ConditionMode: 1 - m_ConditionEvent: isAttacking + m_ConditionEvent: IsAttacking m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -6880058234535011538} diff --git a/Assets/Scenes/Prototype.unity b/Assets/Scenes/Prototype.unity new file mode 100644 index 0000000..0d42caf --- /dev/null +++ b/Assets/Scenes/Prototype.unity @@ -0,0 +1,1096 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &89620392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 89620394} + - component: {fileID: 89620393} + - component: {fileID: 89620395} + - component: {fileID: 89620396} + m_Layer: 8 + m_Name: Square + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &89620393 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 89620392} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &89620394 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 89620392} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -18, y: -8.9, z: 0} + m_LocalScale: {x: 19.08, y: 6.92, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1839735485 &89620395 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 89620392} + m_Enabled: 1 + m_Tiles: {} + m_AnimatedTiles: {} + m_TileAssetArray: [] + m_TileSpriteArray: [] + m_TileMatrixArray: [] + m_TileColorArray: [] + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: 0, y: 0, z: 0} + m_Size: {x: 0, y: 0, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!61 &89620396 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 89620392} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!1 &466908289 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 466908291} + - component: {fileID: 466908290} + - component: {fileID: 466908292} + - component: {fileID: 466908293} + m_Layer: 8 + m_Name: Square (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &466908290 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 466908289} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &466908291 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 466908289} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 24.3, y: 19.5, z: 0} + m_LocalScale: {x: 19.08, y: 6.92, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} +--- !u!1839735485 &466908292 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 466908289} + m_Enabled: 1 + m_Tiles: {} + m_AnimatedTiles: {} + m_TileAssetArray: [] + m_TileSpriteArray: [] + m_TileMatrixArray: [] + m_TileColorArray: [] + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: 0, y: 0, z: 0} + m_Size: {x: 0, y: 0, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!61 &466908293 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 466908289} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!1 &743703306 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 743703308} + - component: {fileID: 743703307} + - component: {fileID: 743703309} + - component: {fileID: 743703310} + m_Layer: 0 + m_Name: Enemy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &743703307 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 743703306} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &743703308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 743703306} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -47.8, y: -47.4, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &743703309 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 743703306} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: df3d81532da45c54d87eaf26c7c58900, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 1265954503} + speed: 20 + turnSpeed: 3 + turnDistance: 2 + stoppingDistance: 10 + stop: 0 + agentDestination: {x: 0, y: 0} +--- !u!114 &743703310 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 743703306} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c95cee1561fee644e88708dfeb6b8510, type: 3} + m_Name: + m_EditorClassIdentifier: + fsm: + initialState: {fileID: 0} + currentState: {fileID: 0} + target: {fileID: 0} +--- !u!1 &963720380 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963720383} + - component: {fileID: 963720382} + - component: {fileID: 963720381} + - component: {fileID: 963720384} + - component: {fileID: 963720385} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963720381 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963720380} + m_Enabled: 1 +--- !u!20 &963720382 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963720380} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &963720383 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963720380} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &963720384 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963720380} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1779068bc08e0544fb004eda3cbfdefd, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 1265954503} + smoothing: 0 + minPosition: {x: 0, y: 0} + maxPosition: {x: 0, y: 0} +--- !u!114 &963720385 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963720380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84fe0d0d97bef7943b0d336d45b538dc, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 1265954503} + smoothing: 2.01 +--- !u!1 &1014480000 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1014480001} + - component: {fileID: 1014480003} + - component: {fileID: 1014480002} + - component: {fileID: 1014480004} + - component: {fileID: 1014480005} + - component: {fileID: 1014480006} + - component: {fileID: 1014480007} + m_Layer: 0 + m_Name: Ground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1014480001 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1268148638} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!483693784 &1014480002 +TilemapRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_ChunkSize: {x: 32, y: 32, z: 32} + m_ChunkCullingBounds: {x: 0, y: 0, z: 0} + m_MaxChunkCount: 16 + m_MaxFrameAge: 16 + m_SortOrder: 0 + m_Mode: 0 + m_DetectChunkCullingBounds: 0 + m_MaskInteraction: 0 +--- !u!1839735485 &1014480003 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_Tiles: {} + m_AnimatedTiles: {} + m_TileAssetArray: [] + m_TileSpriteArray: [] + m_TileMatrixArray: [] + m_TileColorArray: [] + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: 0, y: 0, z: 0} + m_Size: {x: 0, y: 0, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!114 &1014480004 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3a4210d417081fa4da09596e11a29c19, type: 3} + m_Name: + m_EditorClassIdentifier: + displayGridGizmos: 0 + unwalkableMask: + serializedVersion: 2 + m_Bits: 256 + gridWorldSize: {x: 100, y: 100} + nodeRadius: 0.5 + walkableTerrains: [] + obstacleProxPenalty: 50 +--- !u!114 &1014480005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1299bd7b4d4cc14492091ab5d45cf1a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!19719996 &1014480006 +TilemapCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_MaximumTileChangeCount: 1000 + m_ExtrusionFactor: 0.00001 +--- !u!114 &1014480007 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1014480000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1005d7bc1974a5e4db284e7078ff757d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1265954503 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + m_PrefabInstance: {fileID: 1378569865} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1268148636 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1268148638} + - component: {fileID: 1268148637} + m_Layer: 0 + m_Name: Grid + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!156049354 &1268148637 +Grid: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1268148636} + m_Enabled: 1 + m_CellSize: {x: 1, y: 1, z: 0} + m_CellGap: {x: 0, y: 0, z: 0} + m_CellLayout: 0 + m_CellSwizzle: 0 +--- !u!4 &1268148638 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1268148636} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1014480001} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1378569865 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7125823908817143911, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.x + value: 42 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.y + value: 41.1 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} +--- !u!1 &2120984397 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2120984399} + - component: {fileID: 2120984398} + - component: {fileID: 2120984400} + - component: {fileID: 2120984401} + m_Layer: 8 + m_Name: Square (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &2120984398 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120984397} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &2120984399 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120984397} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 8, y: -13.8, z: 0} + m_LocalScale: {x: 19.08, y: 6.92, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} +--- !u!1839735485 &2120984400 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120984397} + m_Enabled: 1 + m_Tiles: {} + m_AnimatedTiles: {} + m_TileAssetArray: [] + m_TileSpriteArray: [] + m_TileMatrixArray: [] + m_TileColorArray: [] + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: 0, y: 0, z: 0} + m_Size: {x: 0, y: 0, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!61 &2120984401 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120984397} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 diff --git a/Assets/Scenes/Prototype.unity.meta b/Assets/Scenes/Prototype.unity.meta new file mode 100644 index 0000000..d2aa957 --- /dev/null +++ b/Assets/Scenes/Prototype.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 926bc251235b22144b7f15fb352f9904 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 3d09674..e4c0d4d 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -1945,306 +1945,11 @@ m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &195632453 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 195632463} - - component: {fileID: 195632462} - - component: {fileID: 195632461} - - component: {fileID: 195632460} - - component: {fileID: 195632459} - - component: {fileID: 195632458} - - component: {fileID: 195632457} - - component: {fileID: 195632456} - - component: {fileID: 195632455} - - component: {fileID: 195632454} - - component: {fileID: 195632466} - - component: {fileID: 195632464} - - component: {fileID: 195632465} - m_Layer: 0 - m_Name: Player - m_TagString: Player - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &195632454 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c8ed50b42c01c564a9bf01014f8c08d3, type: 3} - m_Name: - m_EditorClassIdentifier: - levelText: {fileID: 1127100670} ---- !u!114 &195632455 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ea89a6a57594f3d40a7b984b41053e7d, type: 3} - m_Name: - m_EditorClassIdentifier: - life: 100 - maxlife: 100 - timer: 0 - regenerationtimer: 1500 ---- !u!114 &195632456 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 73cef4819c7d9c04e833f7fa34a1777b, type: 3} - m_Name: - m_EditorClassIdentifier: - exp: 0 - maxlevel: 5 - currentmaxexp: 0 - Level: 1 - arrayPoints: 0 - maxexp: - normalattackpower: - strongattackpower: - defensepower: - BossSlimeKilled: 0 ---- !u!114 &195632457 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7459d2500afe10b42b36c3b1319692b8, type: 3} - m_Name: - m_EditorClassIdentifier: - gold: 0 - goldText: {fileID: 2037656806} - goldTextUpgrades: {fileID: 5076675122054079866} ---- !u!114 &195632458 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5cc9ed0233db52646b1f70797372a8eb, type: 3} - m_Name: - m_EditorClassIdentifier: - anim: {fileID: 0} - flashActive: 0 - flashLength: 1 - flashCounter: 1 - health: 100 - mana: 100 - speed: 5 - isAttacking: 0 - attackBaseValue: 20 - attackRange: 1 - attackTimer: 1.5 - maxAttackTimer: 1.5 - normalAttack: 0 - strongAttack: 0 - shield: 0 - normalPlayerAttack: 10 - strongPlayerAttack: 15 - defensePlayer: 5 ---- !u!114 &195632459 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 052a7562be129084da93a8d4c1580a73, type: 3} - m_Name: - m_EditorClassIdentifier: - healthBar: {fileID: 1632848705} - hpText: {fileID: 1002931538} ---- !u!114 &195632460 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d54a42d75efe0e4498576706cd23a901, type: 3} - m_Name: - m_EditorClassIdentifier: - expBar: {fileID: 642773893} - exptext: {fileID: 994842430} ---- !u!95 &195632461 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: fc054428e738f6c49b5f60695fe41608, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!212 &195632462 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: -862486127 - m_SortingLayer: 2 - m_SortingOrder: 1 - m_Sprite: {fileID: -7467255177931487467, guid: 6f06208b05e77824aaeaaf50550a990d, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 16, y: 16} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!4 &195632463 +--- !u!4 &195632463 stripped Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + m_PrefabInstance: {fileID: 7125823908978169122} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -261.8, y: -101.8, z: 0} - m_LocalScale: {x: 0.3270065, y: 0.3270065, z: 0.3270065} - m_Children: - - {fileID: 1025219533} - - {fileID: 375335278} - - {fileID: 975241291} - - {fileID: 1617801186} - m_Father: {fileID: 0} - m_RootOrder: 9 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!50 &195632464 -Rigidbody2D: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_BodyType: 0 - m_Simulated: 1 - m_UseFullKinematicContacts: 0 - m_UseAutoMass: 0 - m_Mass: 1 - m_LinearDrag: 0 - m_AngularDrag: 0.05 - m_GravityScale: 0 - m_Material: {fileID: 0} - m_Interpolate: 0 - m_SleepingMode: 1 - m_CollisionDetection: 1 - m_Constraints: 4 ---- !u!61 &195632465 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0.0021018386, y: 0.17944336} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0.5, y: 0.5} - oldSize: {x: 16, y: 16} - newSize: {x: 16, y: 16} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 3.3061156, y: 4.50177} - m_EdgeRadius: 0 ---- !u!114 &195632466 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 195632453} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1e2bb5d1e0bb7d6459140e3db5491669, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &210964425 GameObject: m_ObjectHideFlags: 0 @@ -3362,76 +3067,6 @@ m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &375335277 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 375335278} - - component: {fileID: 375335279} - - component: {fileID: 375335280} - m_Layer: 0 - m_Name: AttackDown - m_TagString: MyWeapon - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &375335278 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 375335277} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 195632463} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &375335279 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 375335277} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0.35314178, y: -3.955204} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 0, y: 0} - newSize: {x: 0, y: 0} - adaptiveTilingThreshold: 0 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 5.75566, y: 2.4125729} - m_EdgeRadius: 0 ---- !u!114 &375335280 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 375335277} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &382131460 GameObject: m_ObjectHideFlags: 0 @@ -4095,7 +3730,7 @@ objectReference: {fileID: 0} - target: {fileID: 7620640769789184759, guid: d2c2706789fb0d8419c79150310d970b, type: 3} propertyPath: m_AnchoredPosition.y - value: 2.903 + value: 2.96 objectReference: {fileID: 0} - target: {fileID: 7620640769789184759, guid: d2c2706789fb0d8419c79150310d970b, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -6319,6 +5954,132 @@ m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &935885160 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 935885163} + - component: {fileID: 935885162} + - component: {fileID: 935885161} + - component: {fileID: 935885164} + m_Layer: 0 + m_Name: Orc + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &935885161 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935885160} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0.7} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.1} + oldSize: {x: 2.7692308, y: 2.3076923} + newSize: {x: 2.7692308, y: 2.3076923} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1.5, y: 1.5} + m_EdgeRadius: 0 +--- !u!212 &935885162 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935885160} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -862486127 + m_SortingLayer: 2 + m_SortingOrder: 0 + m_Sprite: {fileID: 8793639957104055765, guid: c6d3e18a54ab4998bf1d4fd6f5cef79d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.7692308, y: 2.3076923} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &935885163 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935885160} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -259.0892, y: -102.0699, z: -20.950459} + m_LocalScale: {x: 1.3, y: 1.3, z: 1.3} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &935885164 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935885160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c95cee1561fee644e88708dfeb6b8510, type: 3} + m_Name: + m_EditorClassIdentifier: + fsm: + initialState: {fileID: 0} + currentState: {fileID: 0} --- !u!1 &936472933 GameObject: m_ObjectHideFlags: 0 @@ -6847,76 +6608,6 @@ m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &975241290 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 975241291} - - component: {fileID: 975241292} - - component: {fileID: 975241293} - m_Layer: 0 - m_Name: AttackRight - m_TagString: MyWeapon - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &975241291 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 975241290} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 195632463} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &975241292 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 975241290} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 4.0964613, y: 0.40022945} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 0, y: 0} - newSize: {x: 0, y: 0} - adaptiveTilingThreshold: 0 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 3.260118, y: 7.4507437} - m_EdgeRadius: 0 ---- !u!114 &975241293 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 975241290} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &977596064 GameObject: m_ObjectHideFlags: 0 @@ -7150,76 +6841,6 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1002931536} m_CullTransparentMesh: 1 ---- !u!1 &1025219532 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1025219533} - - component: {fileID: 1025219534} - - component: {fileID: 1025219535} - m_Layer: 0 - m_Name: AttackUp - m_TagString: MyWeapon - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &1025219533 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1025219532} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 195632463} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &1025219534 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1025219532} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0.31165648, y: 5.3144035} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 0, y: 0} - newSize: {x: 0, y: 0} - adaptiveTilingThreshold: 0 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 6.1942625, y: 1.7597103} - m_EdgeRadius: 0 ---- !u!114 &1025219535 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1025219532} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1111989732 GameObject: m_ObjectHideFlags: 0 @@ -9828,76 +9449,6 @@ m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &1617801185 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1617801186} - - component: {fileID: 1617801187} - - component: {fileID: 1617801188} - m_Layer: 0 - m_Name: AttackLeft - m_TagString: MyWeapon - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &1617801186 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1617801185} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 195632463} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &1617801187 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1617801185} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: -4.331889, y: 0.23542786} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 0, y: 0} - newSize: {x: 0, y: 0} - adaptiveTilingThreshold: 0 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 2.7892585, y: 7.4978323} - m_EdgeRadius: 0 ---- !u!114 &1617801188 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1617801185} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1620552367 GameObject: m_ObjectHideFlags: 0 @@ -134379,6 +133930,10 @@ propertyPath: m_ColliderPaths.Array.data[0].m_ColliderPaths.Array.data[79].Array.data[317].Y value: 160156256 objectReference: {fileID: 0} + - target: {fileID: 8100243170263831093, guid: 1c6e96519446cbe49afcbba2f9eed568, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8100243171636292768, guid: 1c6e96519446cbe49afcbba2f9eed568, type: 3} propertyPath: m_RootOrder value: 11 @@ -134865,6 +134420,91 @@ objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: fff10f1bd790b2847be8c92e02108d6f, type: 3} +--- !u!1001 &7125823908978169122 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7125823908817143908, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: levelText + value: + objectReference: {fileID: 1127100670} + - target: {fileID: 7125823908817143911, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143913, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: hpText + value: + objectReference: {fileID: 1002931538} + - target: {fileID: 7125823908817143913, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: healthBar + value: + objectReference: {fileID: 1632848705} + - target: {fileID: 7125823908817143915, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: goldText + value: + objectReference: {fileID: 2037656806} + - target: {fileID: 7125823908817143915, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: goldTextUpgrades + value: + objectReference: {fileID: 5076675122054079866} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.x + value: -261.8 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.y + value: -101.8 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143917, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7125823908817143918, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: expBar + value: + objectReference: {fileID: 642773893} + - target: {fileID: 7125823908817143918, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} + propertyPath: exptext + value: + objectReference: {fileID: 994842430} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0cf11774487a5ee47a41ba8097423209, type: 3} --- !u!114 &7334079531993622396 MonoBehaviour: m_ObjectHideFlags: 0 @@ -717569,6 +717209,7 @@ - component: {fileID: 7598994792914516232} - component: {fileID: 7598994792914516230} - component: {fileID: 7598994792914516231} + - component: {fileID: 7598994792914516234} m_Layer: 0 m_Name: Ground m_TagString: Untagged @@ -717576,6 +717217,23 @@ m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &7598994792914516234 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7598994792914516233} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3a4210d417081fa4da09596e11a29c19, type: 3} + m_Name: + m_EditorClassIdentifier: + unwalkableMask: + serializedVersion: 2 + m_Bits: 0 + gridWorldSize: {x: 64.57, y: 7.33} + nodeRadius: 0 --- !u!1 &7598994793036646816 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Interfaces.meta b/Assets/Scripts/Interfaces.meta new file mode 100644 index 0000000..037d77f --- /dev/null +++ b/Assets/Scripts/Interfaces.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 40908dc94d328ca4ca956dfa22b07120 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Interfaces/IHealthSystem.cs b/Assets/Scripts/Interfaces/IHealthSystem.cs new file mode 100644 index 0000000..1ba754d --- /dev/null +++ b/Assets/Scripts/Interfaces/IHealthSystem.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public interface IHealthSystem +{ + public void Heal(float ammount); + public void TakeDamage(float ammount); + + public bool IsDead(); + public float GetHealth(); +} diff --git a/Assets/Scripts/Interfaces/IHealthSystem.cs.meta b/Assets/Scripts/Interfaces/IHealthSystem.cs.meta new file mode 100644 index 0000000..0f876a5 --- /dev/null +++ b/Assets/Scripts/Interfaces/IHealthSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4089eb98b2e161944b9f6fe8dd6bd993 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM.meta b/Assets/Scripts/NPC/FSM.meta new file mode 100644 index 0000000..e351c7a --- /dev/null +++ b/Assets/Scripts/NPC/FSM.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aec22a2c5c8713c4ebc54a40eaf26741 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM/Action.cs b/Assets/Scripts/NPC/FSM/Action.cs new file mode 100644 index 0000000..e6925ca --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Action.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.AI.FinitStateMachine +{ + [CreateAssetMenu(menuName = "Finite State Machine/Action")] + public abstract class Action : ScriptableObject + { + //Runs Action + public abstract void Run(FSM fsm); + } +} diff --git a/Assets/Scripts/NPC/FSM/Action.cs.meta b/Assets/Scripts/NPC/FSM/Action.cs.meta new file mode 100644 index 0000000..9ec63ce --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Action.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 919e6e4d5211a384184889a157785ff6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM/Condition.cs b/Assets/Scripts/NPC/FSM/Condition.cs new file mode 100644 index 0000000..0369623 --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Condition.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.AI.FinitStateMachine +{ + [CreateAssetMenu(menuName = "Finite State Machine/Condition")] + public abstract class Condition : ScriptableObject + { + public abstract bool CheckCondition(FSM fsm); + } + +} \ No newline at end of file diff --git a/Assets/Scripts/NPC/FSM/Condition.cs.meta b/Assets/Scripts/NPC/FSM/Condition.cs.meta new file mode 100644 index 0000000..ae7c9d9 --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Condition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8686c16669d591349aa121f70490414d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM/FSM.cs b/Assets/Scripts/NPC/FSM/FSM.cs new file mode 100644 index 0000000..d1fb3ce --- /dev/null +++ b/Assets/Scripts/NPC/FSM/FSM.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.AI.FinitStateMachine +{ + [System.Serializable] + public class FSM + { + private NPCConroller controller; + [SerializeField] private State initialState; + [SerializeField] private State currentState; + [SerializeField] private GameObject target; + + public GameObject Target => target; + public NPCConroller Controller => controller; + + public void SetUp() + { + if (initialState != null) + { + Debug.Log($"{controller.gameObject.name} initial state is {initialState}"); + initialState.GetentryActions(); + currentState = initialState; + } + + else + { + Debug.LogError($"The NPC doesn't have an Initial State"); + } + } + + // Called Every Frame + public void GUpdate() + { + if (currentState != null) + { + if (currentState.GetActions().Count > 0) + { + foreach (Action action in currentState.GetActions()) + { + action.Run(this); + } + } + + Transition triggeredTransition = currentState.GetTriggeredTransition(this); + + if (triggeredTransition != null) + { + ChangeState(triggeredTransition.TargetState()); + } + } + } + + public void ChangeState(State state) + { + currentState.GetExitAction().Run(this); //Runs the exit action + state.EnterState(this); + } + + public State CurrentState() => currentState; + public FSM(NPCConroller controller) + { + this.controller = controller; + SetUp(); + } + } +} diff --git a/Assets/Scripts/NPC/FSM/FSM.cs.meta b/Assets/Scripts/NPC/FSM/FSM.cs.meta new file mode 100644 index 0000000..fce18e9 --- /dev/null +++ b/Assets/Scripts/NPC/FSM/FSM.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 51f43cc9e43d6a340b860f1495565b51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM/State.cs b/Assets/Scripts/NPC/FSM/State.cs new file mode 100644 index 0000000..2b07b8d --- /dev/null +++ b/Assets/Scripts/NPC/FSM/State.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.AI.FinitStateMachine +{ + [CreateAssetMenu(menuName = "Finite State Machine/State")] + public class State : ScriptableObject + { + [SerializeField] private List entryActions; + [SerializeField] private List transitions = new List(); + [SerializeField] private List actions; + [SerializeField] private Action exitAction; + + public List GetentryActions() => entryActions; + public List GetActions() => actions; + public List GetTransitions() => transitions; + public Action GetExitAction() => exitAction; + + //Runs the entry actions of the state + public void EnterState(FSM fsm) + { + if (entryActions.Count > 0) + { + foreach (Action action in entryActions) + { + action.Run(fsm); + } + } + } + + //Gets a triggered transition if any of the transition is true + public Transition GetTriggeredTransition(FSM fsm) + { + if (transitions.Count > 0) + { + foreach (Transition transition in transitions) + { + if (transition.IsTriggered(fsm)) + { + return transition; + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/NPC/FSM/State.cs.meta b/Assets/Scripts/NPC/FSM/State.cs.meta new file mode 100644 index 0000000..7b25092 --- /dev/null +++ b/Assets/Scripts/NPC/FSM/State.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e5d42aa554d6614e9d198b0b751cc65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/FSM/Transition.cs b/Assets/Scripts/NPC/FSM/Transition.cs new file mode 100644 index 0000000..f150969 --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Transition.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.AI.FinitStateMachine +{ + [CreateAssetMenu(menuName = "Finite State Machine/Transition")] + public class Transition : ScriptableObject + { + [SerializeField] private Condition condition; + [SerializeField] private State targetState; + [SerializeField] private Action action; + + public bool IsTriggered(FSM fsm) => condition.CheckCondition(fsm); + public State TargetState() => targetState; + + public Action GetAction() => action; + + public Condition GetCondition() => condition; + } +} diff --git a/Assets/Scripts/NPC/FSM/Transition.cs.meta b/Assets/Scripts/NPC/FSM/Transition.cs.meta new file mode 100644 index 0000000..03e3a0c --- /dev/null +++ b/Assets/Scripts/NPC/FSM/Transition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6af03f2a2f4c7994cb57d6e4a1646605 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/NPCConroller.cs b/Assets/Scripts/NPC/NPCConroller.cs new file mode 100644 index 0000000..63df03b --- /dev/null +++ b/Assets/Scripts/NPC/NPCConroller.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MyCollections.AI.FinitStateMachine; + +public class NPCConroller : MonoBehaviour +{ + [SerializeField] private FSM fsm; + private Agent agent; + + public Agent Agent => agent; + + private void Awake() + { + agent = GetComponent(); + } + // Start is called before the first frame update + void Start() + { + fsm = new FSM(this); + } + + // Update is called once per frame + void Update() + { + fsm.GUpdate(); + } +} diff --git a/Assets/Scripts/NPC/NPCConroller.cs.meta b/Assets/Scripts/NPC/NPCConroller.cs.meta new file mode 100644 index 0000000..8e3a914 --- /dev/null +++ b/Assets/Scripts/NPC/NPCConroller.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c95cee1561fee644e88708dfeb6b8510 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc.meta b/Assets/Scripts/NPC/Orc.meta new file mode 100644 index 0000000..9cf98ed --- /dev/null +++ b/Assets/Scripts/NPC/Orc.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2eed76b44f147748888c331311f5842 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/Actions.meta b/Assets/Scripts/NPC/Orc/Actions.meta new file mode 100644 index 0000000..a6a3769 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Actions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a1f9a759b0fa934f8323cb70c2f2281 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset b/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset new file mode 100644 index 0000000..5001621 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset @@ -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: 30942a40ec7d1d64fa015aad397b710a, type: 3} + m_Name: ChaseTarget + m_EditorClassIdentifier: + target: {fileID: 0} diff --git a/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset.meta b/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset.meta new file mode 100644 index 0000000..73e4b20 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Actions/ChaseTarget.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 592981a221a482047bb06c48da4742d4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs b/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs new file mode 100644 index 0000000..efcc9a0 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MyCollections.AI.FinitStateMachine; + +[CreateAssetMenu(menuName = "Finite State Machine/Action/ChaseTarget")] +public class ChaseTartet : Action +{ + public override void Run(FSM fsm) + { + Agent agent = fsm.Controller.Agent; + GameObject target = fsm.Target; + + if (agent != null) + { + if (target != null) + { + agent.SetDestination(target.transform.position); + } + } + } +} diff --git a/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs.meta b/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs.meta new file mode 100644 index 0000000..bba9ac1 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Actions/ChaseTartet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30942a40ec7d1d64fa015aad397b710a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/Conditions.meta b/Assets/Scripts/NPC/Orc/Conditions.meta new file mode 100644 index 0000000..8ac50ff --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Conditions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ea139046ee8a074a822d2a0de0e4ffa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/States.meta b/Assets/Scripts/NPC/Orc/States.meta new file mode 100644 index 0000000..ab58d74 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc84b3aa1f0bdc049bd8e715fb0cfa2a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/States/Chase.asset b/Assets/Scripts/NPC/Orc/States/Chase.asset new file mode 100644 index 0000000..4858dde --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Chase.asset @@ -0,0 +1,19 @@ +%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: 7e5d42aa554d6614e9d198b0b751cc65, type: 3} + m_Name: Chase + m_EditorClassIdentifier: + entryActions: [] + transitions: [] + actions: + - {fileID: 11400000, guid: 592981a221a482047bb06c48da4742d4, type: 2} + exitAction: {fileID: 0} diff --git a/Assets/Scripts/NPC/Orc/States/Chase.asset.meta b/Assets/Scripts/NPC/Orc/States/Chase.asset.meta new file mode 100644 index 0000000..3c6bba4 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Chase.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 46e233bbb8a097e45828adee0507c870 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/States/Idle.asset b/Assets/Scripts/NPC/Orc/States/Idle.asset new file mode 100644 index 0000000..a45a85e --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Idle.asset @@ -0,0 +1,18 @@ +%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: 7e5d42aa554d6614e9d198b0b751cc65, type: 3} + m_Name: Idle + m_EditorClassIdentifier: + entryActions: [] + transitions: [] + actions: [] + exitAction: {fileID: 0} diff --git a/Assets/Scripts/NPC/Orc/States/Idle.asset.meta b/Assets/Scripts/NPC/Orc/States/Idle.asset.meta new file mode 100644 index 0000000..9013e18 --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Idle.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f544bbd18c02f304386d6f1c01fb3431 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/States/Patrol.asset b/Assets/Scripts/NPC/Orc/States/Patrol.asset new file mode 100644 index 0000000..8b30d5f --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Patrol.asset @@ -0,0 +1,18 @@ +%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: 7e5d42aa554d6614e9d198b0b751cc65, type: 3} + m_Name: Patrol + m_EditorClassIdentifier: + entryActions: [] + transitions: [] + actions: [] + exitAction: {fileID: 0} diff --git a/Assets/Scripts/NPC/Orc/States/Patrol.asset.meta b/Assets/Scripts/NPC/Orc/States/Patrol.asset.meta new file mode 100644 index 0000000..bba75bd --- /dev/null +++ b/Assets/Scripts/NPC/Orc/States/Patrol.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4f7f22025830a5a4285462c8b29a39a7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Orc/Transitions.meta b/Assets/Scripts/NPC/Orc/Transitions.meta new file mode 100644 index 0000000..2a764bc --- /dev/null +++ b/Assets/Scripts/NPC/Orc/Transitions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2f8e12935a968d645b65e8745e5ae77c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding.meta b/Assets/Scripts/NPC/Pathfinding.meta new file mode 100644 index 0000000..9a3a43d --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bcc2839ceb208ed4fbad6c66c1b303bb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Agent.cs b/Assets/Scripts/NPC/Pathfinding/Agent.cs new file mode 100644 index 0000000..03b621d --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Agent.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +public class Agent : MonoBehaviour +{ + public Transform target; + public float speed = 20f; + public float turnSpeed = 3f; + public float turnDistance = 2f; + public float stoppingDistance = 10f; + + public const float pathRequestUpdateTime = 0.2f; + public const float pathUpdateMoveThreshold = 0.5f; + + private Path path; + [SerializeField] private bool stop; + [SerializeField] private Vector2 agentDestination; + public bool agentStop { get => stop; set => stop = value; } + + private void Awake() + { + stop = false; + agentDestination = Vector2.zero; + } + + private void Start() + { + StartCoroutine(UpdatePath()); + } + + public void OnPathFound(Vector2[] waypoints, bool pathSuccessfull) + { + if (pathSuccessfull) + { + Debug.Log($"WAYPOINTS: {waypoints.Length}"); + path = new Path(waypoints, transform.position, turnDistance, stoppingDistance); + StopCoroutine("FollowPath"); + StartCoroutine("FollowPath"); + } + } + + + private IEnumerator UpdatePath() + { + while (true) + { + Debug.Log("LET ME RUN!"); + if (agentDestination != Vector2.zero) + { + if (Time.timeSinceLevelLoad < 0.3f) + { + yield return new WaitForSeconds(.3f); + } + PathRequestManager.RequestPath(new PathRequest(transform.position, agentDestination, OnPathFound)); + + float sqrMoveThreshold = pathUpdateMoveThreshold * pathUpdateMoveThreshold; + Vector2 destinationOldPos = agentDestination; + + while (agentDestination != Vector2.zero) + { + yield return new WaitForSeconds(pathRequestUpdateTime); + + if ((agentDestination - destinationOldPos).sqrMagnitude > sqrMoveThreshold) + { + PathRequestManager.RequestPath(new PathRequest(transform.position, agentDestination, OnPathFound)); + destinationOldPos = agentDestination; + } + } + } + + // Wait for a short time before checking the destination again + yield return new WaitForSeconds(0.2f); + } + } + + private IEnumerator FollowPath() + { + bool followingPath = true; + int pathIndex = 0; + Vector2 moveDirection = Vector2.zero; + + float speedPercent = 1f; + + while (followingPath) + { + if (stop) + { + yield return null; + continue; + } + + Vector2 position = new Vector2(transform.position.x, transform.position.y); + while (path.turnBoundaries[pathIndex].HasCrossedLine(position)) + { + if (pathIndex == path.finishLineIndex) + { + followingPath = false; + break; + } + else + pathIndex++; + + } + + if (followingPath) + { + if (pathIndex >= path.slowDownIndex && stoppingDistance > 0) + { + speedPercent = Mathf.Clamp01(path.turnBoundaries[path.finishLineIndex].DistanceFromPoint(position) / stoppingDistance); + + if (speedPercent < 0.01f) + { + followingPath = false; + } + } + + Vector2 targetDirection = (path.lookPoints[pathIndex] - position).normalized; + moveDirection = Vector2.Lerp(moveDirection, targetDirection, Time.deltaTime * turnSpeed).normalized; + position += moveDirection * speed * speedPercent * Time.deltaTime; + + transform.position = new Vector3(position.x, position.y, transform.position.z); + + } + + yield return null; + } + } + + public void SetDestination(Vector2 newDestination) => agentDestination = newDestination; + + private void OnDrawGizmos() + { + if (path != null) + { + path.DrawWithGizmos(); + } + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Agent.cs.meta b/Assets/Scripts/NPC/Pathfinding/Agent.cs.meta new file mode 100644 index 0000000..92482f3 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Agent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: df3d81532da45c54d87eaf26c7c58900 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Grid.cs b/Assets/Scripts/NPC/Pathfinding/Grid.cs new file mode 100644 index 0000000..facd699 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Grid.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Grid : MonoBehaviour +{ + public bool displayGridGizmos; + + public LayerMask unwalkableMask; + public Vector2 gridWorldSize; + public float nodeRadius; + public TerrainType[] walkableTerrains; + public int obstacleProxPenalty = 50; + + private LayerMask walkableMask; + private Dictionary walkableRegionsDictionary = new Dictionary(); + private Node[,] grid; + private float nodeDiameter; + private int gridSizeX, gridSizeY; + private int penaltyMin = int.MaxValue; + private int penaltyMax = int.MinValue; + + public int MaxSize => gridSizeX * gridSizeY; + + private void Awake() + { + nodeDiameter = nodeRadius * 2; + gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter); + gridSizeY = Mathf.RoundToInt(gridWorldSize.y / nodeDiameter); + + foreach (TerrainType type in walkableTerrains) + { + walkableMask.value = walkableMask |= type.terrainMask.value; + walkableRegionsDictionary.Add((int)Mathf.Log(type.terrainMask.value,2), type.terrainPenalty); + } + + CreateGrid(); + } + + private void OnDrawGizmos() + { + Gizmos.DrawWireCube(transform.position, new Vector2(gridWorldSize.x, gridWorldSize.y)); + + if (grid != null && displayGridGizmos) + { + foreach (Node node in grid) + { + Gizmos.color = Color.Lerp(Color.white, Color.red, Mathf.InverseLerp(penaltyMin, penaltyMax, node.movementPenalty)); + Gizmos.color = (node.walkable) ? Gizmos.color : Color.black; + + + Gizmos.DrawCube(node.worldPos, Vector2.one * (nodeDiameter - 0.1f)); + } + } + } + + public Node NodeFromWorldPoint(Vector2 worldPosition) + { + float percentX = (worldPosition.x + gridWorldSize.x / 2) / gridWorldSize.x; + float percentY = (worldPosition.y + gridWorldSize.y / 2) / gridWorldSize.y; + + percentX = Mathf.Clamp01(percentX); + percentY = Mathf.Clamp01(percentY); + + int x = Mathf.FloorToInt(Mathf.Clamp((gridSizeX) * percentX, 0, gridSizeX - 1)); + int y = Mathf.FloorToInt(Mathf.Clamp((gridSizeY) * percentY, 0, gridSizeY - 1)); + + return grid[x, y]; + } + + private void BlurPenaltyMap(int blurSize) + { + int kernalSize = blurSize * 2 + 1; + int kernelExtents = blurSize; + + int[,] penaltiesHorizontalPass = new int[gridSizeX, gridSizeY]; + int[,] penaltiesVerticalPass = new int[gridSizeX, gridSizeY]; + + for (int y = 0; y < gridSizeY; y++) + { + for (int x = -kernelExtents; x <= kernelExtents; x++) + { + int sampleX = Mathf.Clamp(x, 0, kernelExtents); + penaltiesHorizontalPass[0, y] += grid[sampleX, y].movementPenalty; + } + + for (int x = 1; x < gridSizeX; x++) + { + int removeIndex = Mathf.Clamp(x - kernelExtents - 1, 0, gridSizeX); + int addIndex = Mathf.Clamp(x + kernelExtents, 0, gridSizeX - 1); + + penaltiesHorizontalPass[x, y] = penaltiesHorizontalPass[x - 1, y] - grid[removeIndex, y].movementPenalty + + grid[addIndex, y].movementPenalty; + } + } + + for (int x = 0; x < gridSizeX; x++) + { + for (int y = -kernelExtents; y <= kernelExtents; y++) + { + int sampleY = Mathf.Clamp(x, 0, kernelExtents); + penaltiesVerticalPass[x, 0] += penaltiesHorizontalPass[x, sampleY]; + + } + + int blurredPenalty = Mathf.RoundToInt((float)penaltiesVerticalPass[x, 0] / (kernalSize * kernalSize)); + grid[x, 0].movementPenalty = blurredPenalty; + + for (int y = 1; y < gridSizeY; y++) + { + int removeIndex = Mathf.Clamp(y - kernelExtents - 1, 0, gridSizeY); + int addIndex = Mathf.Clamp(y + kernelExtents, 0, gridSizeY - 1); + + penaltiesVerticalPass[x, y] = penaltiesVerticalPass[x, y - 1] - penaltiesHorizontalPass[x, removeIndex] + + penaltiesHorizontalPass[x, addIndex]; + + blurredPenalty = Mathf.RoundToInt((float)penaltiesVerticalPass[x, y] / (kernalSize * kernalSize)); + grid[x, y].movementPenalty = blurredPenalty; + + if (blurredPenalty > penaltyMax) + penaltyMax = blurredPenalty; + + if (blurredPenalty < penaltyMin) + penaltyMin = blurredPenalty; + } + } + } + + //Returns a list of Neighbours of a node + public List GetNeighbours(Node node) + { + List neighbours = new List(); + + for (int i = -1; i <= 1; i++) + { + for (int j = -1; j <= 1; j++) + { + if (i == 0 && j == 0) continue; + + int checkX = node.gridX + i; + int checkY = node.gridY + j; + + if (checkX >= 0 && checkX < gridSizeX && checkY >= 0 && checkY < gridSizeY) + neighbours.Add(grid[checkX, checkY]); + } + } + + return neighbours; + } + + //Grid Creation + private void CreateGrid() + { + grid = new Node[gridSizeX, gridSizeY]; + Vector2 worldBottomLeftCorner = (Vector2)transform.position - Vector2.right * + gridWorldSize.x / 2 - Vector2.up * gridWorldSize.y / 2; + + for (int i = 0; i < gridSizeX; i++) + { + for (int j = 0; j < gridSizeY; j++) + { + Vector2 worldPoint = worldBottomLeftCorner + Vector2.right * (i * nodeDiameter + nodeRadius) + + Vector2.up * (j * nodeDiameter + nodeRadius); + + bool walkable = (Physics2D.OverlapCircle(worldPoint, nodeRadius, unwalkableMask) == null); + + int movementPenalty = 0; + + + RaycastHit2D hit = Physics2D.CircleCast(worldPoint, nodeRadius + .1f, Vector3.forward, nodeRadius, walkableMask); + + if(hit) + { + walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out movementPenalty); + } + + if (!walkable) + { + movementPenalty += obstacleProxPenalty; + } + + grid[i, j] = new Node(walkable, worldPoint, i, j, movementPenalty); + } + } + + BlurPenaltyMap(3); + } + + [Serializable] + public class TerrainType + { + public LayerMask terrainMask; + public int terrainPenalty; + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Grid.cs.meta b/Assets/Scripts/NPC/Pathfinding/Grid.cs.meta new file mode 100644 index 0000000..65b9f05 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Grid.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a4210d417081fa4da09596e11a29c19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Heap.cs b/Assets/Scripts/NPC/Pathfinding/Heap.cs new file mode 100644 index 0000000..ad58f58 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Heap.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MyCollections.Generic +{ + public class Heap where T : IheapItem + { + T[] items; + int currentItemCount; + public int Count => currentItemCount; + + public Heap(int maxheapSize) => items = new T[maxheapSize]; + + public void Add(T item) + { + item.HeapIndex = currentItemCount; + items[currentItemCount] = item; + SortUp(item); + currentItemCount++; + } + + public T RemoveFirst() + { + T firstItem = items[0]; + currentItemCount--; + items[0] = items[currentItemCount]; + items[0].HeapIndex = 0; + SortDown(items[0]); + return firstItem; + } + + public void UpdateItem(T item) => SortUp(item); + + public bool Contains(T item) => Equals(items[item.HeapIndex], item); + + private void SortDown(T item) + { + while (true) + { + int childIndexLeft = item.HeapIndex * 2 + 1; + int childIndexRight = item.HeapIndex * 2 + 2; + int swapIndex = 0; + + if (childIndexLeft < currentItemCount) + { + swapIndex = childIndexLeft; + + if (childIndexRight < currentItemCount) + { + if (items[childIndexLeft].CompareTo(items[childIndexRight]) < 0) + { + swapIndex = childIndexRight; + } + } + + if (item.CompareTo(items[swapIndex]) < 0) + { + Swap(item, items[swapIndex]); + } + else + { + return; + } + + } + else + { + return; + } + + } + } + + private void SortUp(T item) + { + int parentIndex = (item.HeapIndex - 1) / 2; + + while (true) + { + T parentItem = items[parentIndex]; + if (item.CompareTo(parentItem) > 0) + { + Swap(item, parentItem); + } + else + { + break; + } + + parentIndex = (item.HeapIndex - 1) / 2; + } + } + private void Swap(T itemA, T itemB) + { + items[itemA.HeapIndex] = itemB; + items[itemB.HeapIndex] = itemA; + int itemAIndex = itemA.HeapIndex; + itemA.HeapIndex = itemB.HeapIndex; + itemB.HeapIndex = itemAIndex; + } + } + + public interface IheapItem : IComparable + { + int HeapIndex { get; set; } + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Heap.cs.meta b/Assets/Scripts/NPC/Pathfinding/Heap.cs.meta new file mode 100644 index 0000000..239344e --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Heap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b3ec767f0a7bb3488653e655e5e7b3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Line.cs b/Assets/Scripts/NPC/Pathfinding/Line.cs new file mode 100644 index 0000000..d519960 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Line.cs @@ -0,0 +1,60 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public struct Line +{ + private const float verticalLineGradient = 1e5f; + private float gradient; + private float yIntercept; + private float gradientPerpendicular; + + private Vector2 pointOnLine1; + private Vector2 pointOnLine2; + + private bool approachSide; + + public Line(Vector2 pointOnLine, Vector2 pointPerpendicularToLine) + { + float dx = pointOnLine.x - pointPerpendicularToLine.x; + float dy = pointOnLine.y - pointPerpendicularToLine.y; + + if (dx == 0) + gradientPerpendicular = verticalLineGradient; + else + gradientPerpendicular = dy / dx; + + if(gradientPerpendicular == 0) + gradient = verticalLineGradient; + else + gradient = -1 / gradientPerpendicular; + + yIntercept = pointOnLine.y - gradient * pointOnLine.x; + pointOnLine1 = pointOnLine; + pointOnLine2 = pointOnLine + new Vector2(1, gradient); + + approachSide = false; + approachSide = GetSide(pointPerpendicularToLine); + } + + private bool GetSide(Vector2 p) => (p.x - pointOnLine1.x) * (pointOnLine2.y - pointOnLine1.y) + > (p.y - pointOnLine1.y) * (pointOnLine2.x - pointOnLine1.x); + + public bool HasCrossedLine(Vector2 p) => GetSide(p) != approachSide; + + public float DistanceFromPoint(Vector2 point) + { + float yInterceptPerpendicular = point.y - gradientPerpendicular * point.x; + float intercectX = (yInterceptPerpendicular - yIntercept) / (gradient - gradientPerpendicular); + float intercectY = gradient * intercectX + yIntercept; + return Vector2.Distance(point, new Vector2(intercectX, intercectY)); + } + + public void DrawWithGizmos(float lenght) + { + Vector2 lineDir = new Vector2(1, gradient).normalized; + Vector2 lineCenter = new Vector2(pointOnLine1.x, pointOnLine1.y) + Vector2.up; + + Gizmos.DrawLine(lineCenter - lineDir * lenght/2, lineCenter + lineDir * lenght/2); + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Line.cs.meta b/Assets/Scripts/NPC/Pathfinding/Line.cs.meta new file mode 100644 index 0000000..ef8cbca --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Line.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 193349e005944bd4b88a3c8d82fcf2ae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Node.cs b/Assets/Scripts/NPC/Pathfinding/Node.cs new file mode 100644 index 0000000..5a6f1e4 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Node.cs @@ -0,0 +1,48 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MyCollections.Generic; + +public class Node : IheapItem +{ + public Node parent; + public bool walkable; + public Vector2 worldPos; + public int movementPenalty; + + public int gridX, gridY; + + public int gCost; + public int hCost; //heuristic cost + + private int heapIndex; + + public int FCost => gCost + hCost; + + public int HeapIndex + { + get => heapIndex; + + set => heapIndex = value; + } + + public int CompareTo(Node nodeToCompare) + { + int compare = FCost.CompareTo(nodeToCompare.FCost); + if (compare == 0) + { + compare = hCost.CompareTo(nodeToCompare.hCost); + } + + return -compare; + } + + public Node(bool walkable, Vector2 worldPos, int gridX, int gridY, int movementPenalty) + { + this.walkable = walkable; + this.worldPos = worldPos; + this.gridX = gridX; + this.gridY = gridY; + this.movementPenalty = movementPenalty; + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Node.cs.meta b/Assets/Scripts/NPC/Pathfinding/Node.cs.meta new file mode 100644 index 0000000..59d27de --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Node.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b9ef47b849f3d904bac37e513d860e44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Path.cs b/Assets/Scripts/NPC/Pathfinding/Path.cs new file mode 100644 index 0000000..04e5551 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Path.cs @@ -0,0 +1,54 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Path +{ + public readonly Vector2[] lookPoints; + public readonly Line[] turnBoundaries; + public readonly int finishLineIndex; + public readonly int slowDownIndex; + + public Path(Vector2[] waypoints, Vector2 startPosition, float turnDistance, float stoppingDistance) + { + lookPoints = waypoints; + turnBoundaries = new Line[lookPoints.Length]; + finishLineIndex = turnBoundaries.Length - 1; + + for (int i = 0; i < lookPoints.Length; i++) + { + Vector2 currentPoint = lookPoints[i]; + Vector2 dirToCurrentPoint = (currentPoint - startPosition).normalized; + Vector2 turnBoundaryPoint = (i == finishLineIndex) ? currentPoint : currentPoint - dirToCurrentPoint * turnDistance; + turnBoundaries[i] = new Line(turnBoundaryPoint, startPosition - dirToCurrentPoint * turnDistance); + startPosition = turnBoundaryPoint; + } + + float distanceFromEndPoint = 0; + + for(int i = lookPoints.Length - 1; i > 0; i--) + { + distanceFromEndPoint += Vector2.Distance(lookPoints[i], lookPoints[i - 1]); + if (distanceFromEndPoint > stoppingDistance) + { + slowDownIndex = i; + break; + } + } + } + + public void DrawWithGizmos() + { + Gizmos.color = Color.black; + foreach (Vector2 v in lookPoints) + { + Gizmos.DrawCube(v + Vector2.up, Vector2.one); + } + + Gizmos.color = Color.white; + foreach (Line l in turnBoundaries) + { + l.DrawWithGizmos(10); + } + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Path.cs.meta b/Assets/Scripts/NPC/Pathfinding/Path.cs.meta new file mode 100644 index 0000000..332a5fb --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Path.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 810f732e39325cf449b9090264737aa6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs b/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs new file mode 100644 index 0000000..d292815 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs @@ -0,0 +1,82 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using System.Threading; + +public class PathRequestManager : MonoBehaviour +{ + Queue results = new Queue(); + + + Pathfinding pathdPathfinding; + static PathRequestManager instance; + + private void Awake() + { + instance = this; + pathdPathfinding = GetComponent(); + } + + private void Update() + { + if (results.Count > 0) + { + int itemsInQueue = results.Count; + lock (results) + { + for (int i = 0; i < itemsInQueue; i++) + { + PathResult result = results.Dequeue(); + result.callback(result.path, result.success); + } + } + } + } + + public static void RequestPath(PathRequest request) + { + ThreadStart threadStart = delegate + { + instance.pathdPathfinding.FindPath(request, instance.FinishedProcessingPath); + }; + + threadStart.Invoke(); + } + + public void FinishedProcessingPath(PathResult result) + { + lock (results) { + results.Enqueue(result); + } + } + +} + +public struct PathResult +{ + public Vector2[] path; + public bool success; + public Action callback; + + public PathResult(Vector2[] path, bool success, Action callback) + { + this.path = path; + this.success = success; + this.callback = callback; + } +} + +public struct PathRequest +{ + public Vector2 pathStart; + public Vector2 pathEnd; + public Action callback; + + public PathRequest(Vector2 pathStart, Vector2 pathEnd, Action callback) + { + this.pathStart = pathStart; + this.pathEnd = pathEnd; + this.callback = callback; + } +} \ No newline at end of file diff --git a/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs.meta b/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs.meta new file mode 100644 index 0000000..ce82b2d --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/PathRequestManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1005d7bc1974a5e4db284e7078ff757d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs b/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs new file mode 100644 index 0000000..cc34735 --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs @@ -0,0 +1,122 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Diagnostics; +using MyCollections.Generic; +using System; + +public class Pathfinding : MonoBehaviour +{ + Grid grid; + + private void Awake() + { + grid = GetComponent(); + } + + public void FindPath(PathRequest request, Action callback) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + + Vector2[] waypoints = new Vector2[0]; + bool pathSuccess = false; + + Node startNode = grid.NodeFromWorldPoint(request.pathStart); + Node targetNode = grid.NodeFromWorldPoint(request.pathEnd); + + if (startNode.walkable && targetNode.walkable) + { + Heap openSet = new Heap(grid.MaxSize); + HashSet closeSet = new HashSet(); + openSet.Add(startNode); + + while (openSet.Count > 0) + { + Node currentNode = openSet.RemoveFirst(); + closeSet.Add(currentNode); + + if (currentNode == targetNode) + { + sw.Stop(); + print($"Path found: {sw.ElapsedMilliseconds}ms"); + pathSuccess = true; + break; + } + + foreach (Node neighbour in grid.GetNeighbours(currentNode)) + { + if (!neighbour.walkable || closeSet.Contains(neighbour)) + continue; + + int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour) + neighbour.movementPenalty; + + if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) + { + neighbour.gCost = newMovementCostToNeighbour; + neighbour.hCost = GetDistance(neighbour, targetNode); + neighbour.parent = currentNode; + + if (!openSet.Contains(neighbour)) + openSet.Add(neighbour); + else + openSet.UpdateItem(neighbour); + } + } + } + } + + if (pathSuccess) + { + waypoints = RetracePath(startNode, targetNode); + pathSuccess = waypoints.Length > 0; + } + + callback(new PathResult(waypoints, pathSuccess, request.callback)); + } + + private Vector2[] RetracePath(Node startNode, Node endNode) + { + List path = new List(); + Node currentNode = endNode; + + while (currentNode != startNode) + { + path.Add(currentNode); + currentNode = currentNode.parent; + } + + Vector2[] waypoints = SimplifyPath(path); + Array.Reverse(waypoints); + return waypoints; + } + + private Vector2[] SimplifyPath(List path) + { + List waypoints = new List(); + Vector2 directionOld = Vector2.zero; + + for (int i = 1; i < path.Count; i++) + { + Vector2 directionNew = new Vector2(path[i - 1].gridX - path[i].gridX, path[i - 1].gridY - path[i].gridY); + + if (directionNew != directionOld) + { + waypoints.Add(path[i].worldPos); + } + + directionOld = directionNew; + } + return waypoints.ToArray(); + } + + private int GetDistance(Node nodeA, Node nodeB) + { + int distX = Mathf.Abs(nodeA.gridX - nodeB.gridX); + int distY = Mathf.Abs(nodeA.gridY - nodeB.gridY); + + if (distX > distY) + return 14 * distY + 10 * (distX - distY); + return 14 * distX + 10 * (distY - distX); + } +} diff --git a/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs.meta b/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs.meta new file mode 100644 index 0000000..0fd90aa --- /dev/null +++ b/Assets/Scripts/NPC/Pathfinding/Pathfinding.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1299bd7b4d4cc14492091ab5d45cf1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/Interfaces.meta b/Assets/Scripts/Player/Interfaces.meta deleted file mode 100644 index 037d77f..0000000 --- a/Assets/Scripts/Player/Interfaces.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 40908dc94d328ca4ca956dfa22b07120 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Player/Interfaces/IHealthSystem.cs b/Assets/Scripts/Player/Interfaces/IHealthSystem.cs deleted file mode 100644 index 1ba754d..0000000 --- a/Assets/Scripts/Player/Interfaces/IHealthSystem.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public interface IHealthSystem -{ - public void Heal(float ammount); - public void TakeDamage(float ammount); - - public bool IsDead(); - public float GetHealth(); -} diff --git a/Assets/Scripts/Player/Interfaces/IHealthSystem.cs.meta b/Assets/Scripts/Player/Interfaces/IHealthSystem.cs.meta deleted file mode 100644 index 0f876a5..0000000 --- a/Assets/Scripts/Player/Interfaces/IHealthSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4089eb98b2e161944b9f6fe8dd6bd993 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Player/PlayerController.cs b/Assets/Scripts/Player/PlayerController.cs index e573497..4e7598e 100644 --- a/Assets/Scripts/Player/PlayerController.cs +++ b/Assets/Scripts/Player/PlayerController.cs @@ -6,7 +6,7 @@ public class PlayerController : MonoBehaviour, IHealthSystem { private Rigidbody2D rb; - [SerializeField] private Animator anim; + private Animator anim; public bool flashActive; [SerializeField] @@ -31,6 +31,7 @@ [SerializeField] private float maxAttackTimer = 1.5f; private float horizontalInput, verticalInput; + Vector2 lastInput; public bool normalAttack; public bool strongAttack; @@ -58,77 +59,80 @@ PlayerDefend(); PlayerAttack(); PlayerAnimController(); + + Debug.Log($"IsAttacking: {anim.GetBool("IsAttacking")}"); } //Player Movement private void PlayerMovement() { - if (!isAttacking) - { - //Get Keyboard Input values - horizontalInput = Input.GetAxisRaw("Horizontal"); - verticalInput = Input.GetAxisRaw("Vertical"); + //Get Keyboard Input values + horizontalInput = Input.GetAxisRaw("Horizontal"); + verticalInput = Input.GetAxisRaw("Vertical"); - //Set velocity based on the input - rb.velocity = new Vector2(horizontalInput, verticalInput).normalized * speed; - } + //Set velocity based on the input + rb.velocity = new Vector2(horizontalInput, verticalInput).normalized * speed; + + if (rb.velocity != Vector2.zero) lastInput = new Vector2(horizontalInput, verticalInput).normalized; } //Player Attack private void PlayerAttack() { - if (Input.GetMouseButtonDown(0)) - { - rb.velocity = Vector3.zero; //Sets the character velocity to 0 - isAttacking = true; - attackTimer = 0f; // Reset attack timer + if (Input.GetMouseButton(0)) + { + isAttacking = true; + Debug.Log("PLayer Attacking: " + isAttacking); + + if (attackTimer <= maxAttackTimer) attackTimer += Time.deltaTime; + } + + if (Input.GetMouseButtonUp(0) && isAttacking) + { Vector2 origin = transform.position; Vector2 direction = new Vector2(horizontalInput, verticalInput).normalized; - - if (direction == Vector2.zero) - direction = new Vector2(anim.GetFloat("LastMoveX"), anim.GetFloat("LastMoveY")); + anim.SetBool("IsAttacking", true); //Perform attack Animation RaycastHit2D hit = Physics2D.Raycast(origin, direction, attackRange); + Debug.DrawRay(origin, direction, Color.red, 1.5f); + if (hit.collider != null) { if (hit.collider.TryGetComponent(out IHealthSystem healthSystem)) { - healthSystem.TakeDamage(attackBaseValue); + float damage = attackBaseValue + (attackBaseValue * attackTimer); + healthSystem.TakeDamage(damage); } } - anim.SetBool("IsAttacking", true); - } + attackTimer = 0f; // Reset attack timer + isAttacking = false; - if (isAttacking) - { - attackTimer += Time.deltaTime; - - if (attackTimer >= maxAttackTimer) - { - isAttacking = false; - anim.SetBool("IsAttacking", false); - } + // Ensure the animation can play out by delaying the reset of IsAttacking + StartCoroutine(ResetAttackAnimation()); } } + // Coroutine to delay resetting the attack animation + private IEnumerator ResetAttackAnimation() + { + yield return new WaitForSeconds(0.1f); // Adjust the delay as necessary + anim.SetBool("IsAttacking", false); + } + private void PlayerDefend() => shield = Input.GetKey(KeyCode.Space); + //Set Animation Values private void PlayerAnimController() { anim.SetFloat("moveX", horizontalInput); anim.SetFloat("moveY", verticalInput); - - if (isAttacking) - { - //Detect what was the last input - Vector2 vec = new Vector2(horizontalInput, verticalInput); - anim.SetFloat("LastMoveX", vec.x); - anim.SetFloat("LastMoveY", vec.y); - } + anim.SetFloat("LastMoveX", lastInput.x); + anim.SetFloat("LastMoveY", lastInput.y); + anim.SetFloat("Velocity", new Vector2(horizontalInput, verticalInput).normalized.magnitude); } public void TakeDamage(float ammount) => health -= ammount; diff --git a/Assets/Scripts/Prefabs.meta b/Assets/Scripts/Prefabs.meta new file mode 100644 index 0000000..76933a2 --- /dev/null +++ b/Assets/Scripts/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 03ddf1d068828364bba90cfe5fd522d9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Prefabs/Player.prefab b/Assets/Scripts/Prefabs/Player.prefab new file mode 100644 index 0000000..888d92b --- /dev/null +++ b/Assets/Scripts/Prefabs/Player.prefab @@ -0,0 +1,581 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7125823908444158659 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7125823908444158656} + - component: {fileID: 7125823908444158657} + - component: {fileID: 7125823908444158662} + m_Layer: 0 + m_Name: AttackLeft + m_TagString: MyWeapon + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7125823908444158656 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908444158659} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7125823908817143917} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &7125823908444158657 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908444158659} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -4.331889, y: 0.23542786} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 2.7892585, y: 7.4978323} + m_EdgeRadius: 0 +--- !u!114 &7125823908444158662 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908444158659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7125823908817143911 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7125823908817143917} + - component: {fileID: 7125823908817143916} + - component: {fileID: 7125823908817143919} + - component: {fileID: 7125823908817143918} + - component: {fileID: 7125823908817143913} + - component: {fileID: 7125823908817143912} + - component: {fileID: 7125823908817143915} + - component: {fileID: 7125823908817143914} + - component: {fileID: 7125823908817143909} + - component: {fileID: 7125823908817143908} + - component: {fileID: 7125823908817143920} + - component: {fileID: 7125823908817143922} + - component: {fileID: 7125823908817143923} + m_Layer: 0 + m_Name: Player + m_TagString: Player + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7125823908817143917 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -261.8, y: -101.8, z: 0} + m_LocalScale: {x: 0.3270065, y: 0.3270065, z: 0.3270065} + m_Children: + - {fileID: 7125823909734813423} + - {fileID: 7125823909286263884} + - {fileID: 7125823909613540713} + - {fileID: 7125823908444158656} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7125823908817143916 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -862486127 + m_SortingLayer: 2 + m_SortingOrder: 1 + m_Sprite: {fileID: -7467255177931487467, guid: 6f06208b05e77824aaeaaf50550a990d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 16, y: 16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &7125823908817143919 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: fc054428e738f6c49b5f60695fe41608, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &7125823908817143918 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d54a42d75efe0e4498576706cd23a901, type: 3} + m_Name: + m_EditorClassIdentifier: + expBar: {fileID: 0} + exptext: {fileID: 0} +--- !u!114 &7125823908817143913 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 052a7562be129084da93a8d4c1580a73, type: 3} + m_Name: + m_EditorClassIdentifier: + healthBar: {fileID: 0} + hpText: {fileID: 0} +--- !u!114 &7125823908817143912 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5cc9ed0233db52646b1f70797372a8eb, type: 3} + m_Name: + m_EditorClassIdentifier: + flashActive: 0 + flashLength: 1 + flashCounter: 1 + health: 100 + mana: 100 + speed: 5 + isAttacking: 0 + attackBaseValue: 20 + attackRange: 1 + attackTimer: 1.5 + maxAttackTimer: 1.5 + normalAttack: 0 + strongAttack: 0 + shield: 0 + normalPlayerAttack: 10 + strongPlayerAttack: 15 + defensePlayer: 5 +--- !u!114 &7125823908817143915 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7459d2500afe10b42b36c3b1319692b8, type: 3} + m_Name: + m_EditorClassIdentifier: + gold: 0 + goldText: {fileID: 0} + goldTextUpgrades: {fileID: 0} +--- !u!114 &7125823908817143914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73cef4819c7d9c04e833f7fa34a1777b, type: 3} + m_Name: + m_EditorClassIdentifier: + exp: 0 + maxlevel: 5 + currentmaxexp: 0 + Level: 1 + arrayPoints: 0 + maxexp: + normalattackpower: + strongattackpower: + defensepower: + BossSlimeKilled: 0 +--- !u!114 &7125823908817143909 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ea89a6a57594f3d40a7b984b41053e7d, type: 3} + m_Name: + m_EditorClassIdentifier: + life: 100 + maxlife: 100 + timer: 0 + regenerationtimer: 1500 +--- !u!114 &7125823908817143908 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c8ed50b42c01c564a9bf01014f8c08d3, type: 3} + m_Name: + m_EditorClassIdentifier: + levelText: {fileID: 0} +--- !u!114 &7125823908817143920 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1e2bb5d1e0bb7d6459140e3db5491669, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!50 &7125823908817143922 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 0 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 1 + m_Constraints: 4 +--- !u!61 &7125823908817143923 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823908817143911} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0.0021018386, y: 0.17944336} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 16, y: 16} + newSize: {x: 16, y: 16} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 3.3061156, y: 4.50177} + m_EdgeRadius: 0 +--- !u!1 &7125823909286263887 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7125823909286263884} + - component: {fileID: 7125823909286263885} + - component: {fileID: 7125823909286263890} + m_Layer: 0 + m_Name: AttackDown + m_TagString: MyWeapon + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7125823909286263884 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909286263887} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7125823908817143917} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &7125823909286263885 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909286263887} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0.35314178, y: -3.955204} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 5.75566, y: 2.4125729} + m_EdgeRadius: 0 +--- !u!114 &7125823909286263890 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909286263887} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7125823909613540712 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7125823909613540713} + - component: {fileID: 7125823909613540718} + - component: {fileID: 7125823909613540719} + m_Layer: 0 + m_Name: AttackRight + m_TagString: MyWeapon + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7125823909613540713 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909613540712} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7125823908817143917} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &7125823909613540718 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909613540712} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 4.0964613, y: 0.40022945} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 3.260118, y: 7.4507437} + m_EdgeRadius: 0 +--- !u!114 &7125823909613540719 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909613540712} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7125823909734813422 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7125823909734813423} + - component: {fileID: 7125823909734813420} + - component: {fileID: 7125823909734813421} + m_Layer: 0 + m_Name: AttackUp + m_TagString: MyWeapon + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7125823909734813423 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909734813422} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7125823908817143917} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &7125823909734813420 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909734813422} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0.31165648, y: 5.3144035} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 6.1942625, y: 1.7597103} + m_EdgeRadius: 0 +--- !u!114 &7125823909734813421 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7125823909734813422} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c2c6ceef6220a0a4fac5dfa14072c0cb, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Scripts/Prefabs/Player.prefab.meta b/Assets/Scripts/Prefabs/Player.prefab.meta new file mode 100644 index 0000000..55d699c --- /dev/null +++ b/Assets/Scripts/Prefabs/Player.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0cf11774487a5ee47a41ba8097423209 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 22499b5..5c01146 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -32,7 +32,7 @@ - UI - Quest - - - + - Unwalkable - - -