Création et implémentation des baies. Couramment, donne de la nourriture, mais pourra probablement donner des baies plus tard.

This commit is contained in:
MaximilienBlanchardBizien1 2023-11-01 16:29:44 -04:00 committed by Felix Boucher
parent 4c8b34993a
commit cba5364045
8 changed files with 302 additions and 10 deletions

18
Assets/BushTile.asset Normal file
View File

@ -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: 84b05f2a26f63da46a1028488482d079, type: 3}
m_Name: BushTile
m_EditorClassIdentifier:
_sprite: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3}
_isCollidable: 1
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
_randomPositionConfig: 0.5

View File

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

View File

@ -0,0 +1,221 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6962989255644195630
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6962989255644195631}
- component: {fileID: 6072713849781841816}
- component: {fileID: -1491803373025033585}
- component: {fileID: 2238237770060079311}
- component: {fileID: 3600016298306940116}
m_Layer: 0
m_Name: yieldBerry
m_TagString: Resource
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6962989255644195631
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6.61, y: -0.638, z: 1.8112363}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6962989256011107500}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1839735485 &6072713849781841816
Tilemap:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 0
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!50 &-1491803373025033585
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
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: 0
m_Constraints: 4
--- !u!61 &2238237770060079311
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.05, y: 0.02}
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: 0.3, y: 0.46}
m_EdgeRadius: 0
--- !u!114 &3600016298306940116
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9dd6bad38b516d64e8e23a5822ca37bb, type: 3}
m_Name:
m_EditorClassIdentifier:
_resourceChoice: 3
_endPosition: {x: -2, y: 5}
--- !u!1 &6962989256011107503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6962989256011107500}
- component: {fileID: 6962989256011107501}
m_Layer: 0
m_Name: sprite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6962989256011107500
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989256011107503}
m_LocalRotation: {x: 0, y: -0, z: 0, w: -1}
m_LocalPosition: {x: 0.0259, y: 0.01, z: 0}
m_LocalScale: {x: 0.5394133, y: 0.56488746, z: 0.9686}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6962989255644195631}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 360}
--- !u!212 &6962989256011107501
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989256011107503}
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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 4
m_Sprite: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, 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.06, y: 1.69}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@ -133,7 +133,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9dd6bad38b516d64e8e23a5822ca37bb, type: 3} m_Script: {fileID: 11500000, guid: 9dd6bad38b516d64e8e23a5822ca37bb, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_resourceMakingAmount: 10
_resourceChoice: 2 _resourceChoice: 2
_endPosition: {x: -2, y: 5} _endPosition: {x: -2, y: 5}
--- !u!1 &6962989256011107503 --- !u!1 &6962989256011107503

View File

@ -4,6 +4,7 @@ public class Enum
{ {
Rock, Rock,
Wood, Wood,
Food Food,
Berry
}; };
} }

View File

@ -54,7 +54,21 @@ public class ResourceMaker : MonoBehaviour
if(Vector2.Distance(transform.position,_endPosition) < 0.001f) if(Vector2.Distance(transform.position,_endPosition) < 0.001f)
{ {
_isPlaying = false; _isPlaying = false;
AddResourceToInventory(amount); switch (_resourceChoice)
{
case Enum.ResourceChoice.Rock:
_resourceManagerInstance.RockAmount = amount;
break;
case Enum.ResourceChoice.Wood:
_resourceManagerInstance.WoodAmount = amount;
break;
case Enum.ResourceChoice.Food:
_resourceManagerInstance.FoodAmount = amount;
break;
case Enum.ResourceChoice.Berry:
_resourceManagerInstance.BerryAmount = amount;
break;
}
Destroy(gameObject); Destroy(gameObject);
} }
} }

View File

@ -41,7 +41,7 @@ Grid:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 86010431647272150} m_GameObject: {fileID: 86010431647272150}
m_Enabled: 1 m_Enabled: 1
m_CellSize: {x: 1, y: 1, z: 0} m_CellSize: {x: 1.45, y: 1.45, z: 0}
m_CellGap: {x: 0, y: 0, z: 0} m_CellGap: {x: 0, y: 0, z: 0}
m_CellLayout: 0 m_CellLayout: 0
m_CellSwizzle: 0 m_CellSwizzle: 0
@ -87,6 +87,16 @@ Tilemap:
m_GameObject: {fileID: 5890485537825364348} m_GameObject: {fileID: 5890485537825364348}
m_Enabled: 1 m_Enabled: 1
m_Tiles: m_Tiles:
- first: {x: -1, y: -4, z: 0}
second:
serializedVersion: 2
m_TileIndex: 8
m_TileSpriteIndex: 8
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
- first: {x: -1, y: -3, z: 0} - first: {x: -1, y: -3, z: 0}
second: second:
serializedVersion: 2 serializedVersion: 2
@ -117,6 +127,16 @@ Tilemap:
m_TileObjectToInstantiateIndex: 65535 m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0 dummyAlignment: 0
m_AllTileFlags: 0 m_AllTileFlags: 0
- first: {x: -1, y: -1, z: 0}
second:
serializedVersion: 2
m_TileIndex: 8
m_TileSpriteIndex: 8
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
- first: {x: -1, y: 0, z: 0} - first: {x: -1, y: 0, z: 0}
second: second:
serializedVersion: 2 serializedVersion: 2
@ -195,6 +215,8 @@ Tilemap:
m_Data: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2} m_Data: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2} m_Data: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2}
- m_RefCount: 2
m_Data: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
m_TileSpriteArray: m_TileSpriteArray:
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3} m_Data: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
@ -212,8 +234,10 @@ Tilemap:
m_Data: {fileID: 21300000, guid: 5cf7447a03096c04ead18f1855f01cd7, type: 3} m_Data: {fileID: 21300000, guid: 5cf7447a03096c04ead18f1855f01cd7, type: 3}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 21300000, guid: 8354a544f4ca3514e87d40d2de9afaee, type: 3} m_Data: {fileID: 21300000, guid: 8354a544f4ca3514e87d40d2de9afaee, type: 3}
- m_RefCount: 2
m_Data: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3}
m_TileMatrixArray: m_TileMatrixArray:
- m_RefCount: 9 - m_RefCount: 11
m_Data: m_Data:
e00: 1 e00: 1
e01: 0 e01: 0
@ -232,13 +256,13 @@ Tilemap:
e32: 0 e32: 0
e33: 1 e33: 1
m_TileColorArray: m_TileColorArray:
- m_RefCount: 9 - m_RefCount: 11
m_Data: {r: 1, g: 1, b: 1, a: 1} m_Data: {r: 1, g: 1, b: 1, a: 1}
m_TileObjectToInstantiateArray: [] m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1 m_AnimationFrameRate: 1
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Origin: {x: -1, y: -3, z: 0} m_Origin: {x: -1, y: -4, z: 0}
m_Size: {x: 3, y: 5, z: 1} m_Size: {x: 3, y: 6, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0} m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 0 m_TileOrientation: 0
m_TileOrientationMatrix: m_TileOrientationMatrix:
@ -300,14 +324,14 @@ TilemapRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_ChunkSize: {x: 32, y: 32, z: 32} m_ChunkSize: {x: 32, y: 32, z: 32}
m_ChunkCullingBounds: {x: 0, y: 0, z: 0} m_ChunkCullingBounds: {x: 0.22500002, y: 0.22500002, z: 0}
m_MaxChunkCount: 16 m_MaxChunkCount: 16
m_MaxFrameAge: 16 m_MaxFrameAge: 16
m_SortOrder: 0 m_SortOrder: 0
m_Mode: 0 m_Mode: 0
m_DetectChunkCullingBounds: 0 m_DetectChunkCullingBounds: 0
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!114 &1109561936470111781 --- !u!114 &3671438652071492342
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}