completed health and stamikna script
This commit is contained in:
18
Assets/HealthScript.cs
Normal file
18
Assets/HealthScript.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class HealthScript : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/HealthScript.cs.meta
Normal file
11
Assets/HealthScript.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c2b1c10b368d1641bef76c6874131de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/PlayerContact.cs
Normal file
20
Assets/PlayerContact.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerContact : MonoBehaviour
|
||||
{
|
||||
public Player player;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/PlayerContact.cs.meta
Normal file
11
Assets/PlayerContact.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47ff2cdf170756a4792387a95db53a5f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -10,6 +10,8 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 7123021364386132083}
|
||||
- component: {fileID: 1747974818995494046}
|
||||
- component: {fileID: 5520736153122788072}
|
||||
- component: {fileID: 1518483160148691188}
|
||||
m_Layer: 0
|
||||
m_Name: Coffee
|
||||
m_TagString: Untagged
|
||||
@@ -80,3 +82,50 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!61 &5520736153122788072
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6870250841519595495}
|
||||
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.5, y: 1.5}
|
||||
newSize: {x: 1.5, y: 1.5}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1.5, y: 1.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!50 &1518483160148691188
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6870250841519595495}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
|
||||
@@ -10,6 +10,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 8554420466772133694}
|
||||
- component: {fileID: 256661142209474860}
|
||||
- component: {fileID: -1689152108654162109}
|
||||
- component: {fileID: 271381267833183223}
|
||||
- component: {fileID: -2721928150708373069}
|
||||
m_Layer: 0
|
||||
m_Name: Pizza
|
||||
m_TagString: Untagged
|
||||
@@ -80,3 +83,63 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &-1689152108654162109
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1137786072160203054}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 47ff2cdf170756a4792387a95db53a5f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
player: {fileID: 0}
|
||||
--- !u!61 &271381267833183223
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1137786072160203054}
|
||||
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.5, y: 1.5}
|
||||
newSize: {x: 1.5, y: 1.5}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1.5, y: 1.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!50 &-2721928150708373069
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1137786072160203054}
|
||||
m_BodyType: 2
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
|
||||
@@ -229,7 +229,268 @@ Tilemap:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1491653}
|
||||
m_Enabled: 1
|
||||
m_Tiles: {}
|
||||
m_Tiles:
|
||||
- first: {x: 5, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 6, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 7, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 8, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 9, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 10, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 11, y: 17, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 11, y: 18, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 12, y: 18, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 12, y: 19, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 13, y: 19, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 13, y: 20, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 14, y: 20, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 14, y: 21, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 15, y: 21, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 15, y: 22, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 16, y: 22, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 16, y: 23, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 17, y: 23, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 17, y: 24, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 18, y: 24, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 18, y: 25, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 19, y: 25, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 19, y: 26, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 20, y: 26, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 20, y: 27, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 21, y: 27, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 21, y: 28, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
- first: {x: 22, y: 28, z: 0}
|
||||
second:
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_ObjectToInstantiate: {fileID: 0}
|
||||
m_TileFlags: 1
|
||||
m_ColliderType: 1
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray:
|
||||
- m_RefCount: 0
|
||||
@@ -238,8 +499,8 @@ Tilemap:
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 0
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 0
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 29
|
||||
m_Data: {fileID: 11400000, guid: 72512fd510bbaa54abcab943acdfad9d, type: 2}
|
||||
m_TileSpriteArray:
|
||||
- m_RefCount: 0
|
||||
m_Data: {fileID: 0}
|
||||
@@ -247,34 +508,35 @@ Tilemap:
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 0
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 0
|
||||
m_Data: {fileID: 0}
|
||||
- m_RefCount: 29
|
||||
m_Data: {fileID: 7688254355190835736, guid: 06179a7b27612804c9315624bd8657bc,
|
||||
type: 3}
|
||||
m_TileMatrixArray:
|
||||
- m_RefCount: 0
|
||||
- m_RefCount: 29
|
||||
m_Data:
|
||||
e00: NaN
|
||||
e01: NaN
|
||||
e02: -0.0000000555834
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: NaN
|
||||
e11: NaN
|
||||
e12: 1.18e-43
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: -0.000000055583342
|
||||
e22: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 1.18e-43
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 0
|
||||
e33: 1
|
||||
m_TileColorArray:
|
||||
- m_RefCount: 0
|
||||
m_Data: {r: 6.129018e-32, g: 6.129018e-32, b: 6.129018e-32, a: 6.129018e-32}
|
||||
- m_RefCount: 29
|
||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 68, y: 6, z: 1}
|
||||
m_Size: {x: 68, y: 29, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
@@ -301,11 +563,36 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.x
|
||||
value: 0.040924072
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.x
|
||||
value: 0.9434204
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.y
|
||||
value: -0.09003568
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.y
|
||||
value: 1.3199286
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CoffeeTwo
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -375,6 +662,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: CoffeeSix
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1168,7 +1460,7 @@ GameObject:
|
||||
- component: {fileID: 367096169}
|
||||
- component: {fileID: 367096170}
|
||||
m_Layer: 0
|
||||
m_Name: StaminaBar
|
||||
m_Name: Health
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1182,7 +1474,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 367096168}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -5.39, y: 6.39, z: 6.1276217}
|
||||
m_LocalPosition: {x: -7.7, y: 6.6, z: 6.1276217}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1146013793}
|
||||
@@ -1231,7 +1523,7 @@ SpriteRenderer:
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 2
|
||||
m_Size: {x: 4.5, y: 1.5}
|
||||
m_Size: {x: 1.5, y: 1.5}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
@@ -1249,6 +1541,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: PizzaTwo
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1137786072160203054, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Pizza
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8554420466772133694, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1318,6 +1615,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: CoffeeFife
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1430,20 +1732,45 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.x
|
||||
value: 0.040924072
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.x
|
||||
value: 0.95977783
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.y
|
||||
value: -0.08594322
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.y
|
||||
value: 1.3281136
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CoffeeThree
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 132.6
|
||||
value: 132.502
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 37.8
|
||||
value: 37.694
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
@@ -1538,6 +1865,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: CoffeeFoor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1835,6 +2167,12 @@ MonoBehaviour:
|
||||
groundErrorThreshold: 3
|
||||
wallLineCaseDistance: 1.15
|
||||
runErrorThreshold: 0.05
|
||||
startHealth: 3
|
||||
startStamina: 100
|
||||
coffeValuePercent: 10
|
||||
bugStaminaDamagePercent: 15
|
||||
healthBar: {fileID: 367096170}
|
||||
staminaBar: {fileID: 2086987805}
|
||||
--- !u!95 &1671840923
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
@@ -1866,6 +2204,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: PizzaThree
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1137786072160203054, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Pizza
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8554420466772133694, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -2340,7 +2683,7 @@ GameObject:
|
||||
- component: {fileID: 2086987804}
|
||||
- component: {fileID: 2086987805}
|
||||
m_Layer: 0
|
||||
m_Name: LifeBar
|
||||
m_Name: StaminaBar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -2408,7 +2751,7 @@ SpriteRenderer:
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!1 &2120494076
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -47141,6 +47484,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Pizza
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1137786072160203054, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Pizza
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8554420466772133694, guid: f859e1c9214db2c4eaaeff51febb3222,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -47324,11 +47672,36 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.x
|
||||
value: 0.032886505
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.x
|
||||
value: 0.95738983
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Offset.y
|
||||
value: -0.09043503
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Size.y
|
||||
value: 1.31913
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Coffee
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
||||
@@ -11,6 +11,16 @@ public class Player : MonoBehaviour
|
||||
[SerializeField] private float groundErrorThreshold = 0.05f;
|
||||
[SerializeField] private float wallLineCaseDistance = 0.5f;
|
||||
[SerializeField] private float runErrorThreshold = 0.05f;
|
||||
[SerializeField] private int startHealth = 3;
|
||||
private int currentHealth;
|
||||
[SerializeField] private int startStamina = 100;
|
||||
[SerializeField] private int coffeValuePercent = 10;
|
||||
[SerializeField] private int bugStaminaDamagePercent = 15;
|
||||
private int currentStamina;
|
||||
|
||||
[SerializeField] private SpriteRenderer healthBar;
|
||||
[SerializeField] private SpriteRenderer staminaBar;
|
||||
|
||||
|
||||
private Rigidbody2D rigidBody;
|
||||
new private BoxCollider2D collider;
|
||||
@@ -23,13 +33,51 @@ public class Player : MonoBehaviour
|
||||
rigidBody = GetComponent<Rigidbody2D>();
|
||||
collider = GetComponent<BoxCollider2D>();
|
||||
animator = GetComponent<Animator>();
|
||||
currentHealth = startHealth;
|
||||
currentStamina = startStamina;
|
||||
healthBar.size = new Vector2(1.5f * startHealth, healthBar.size.y);
|
||||
staminaBar.size = new Vector2(staminaBar.size.x, staminaBar.size.y);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
{
|
||||
MovePlayer();
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D coll)
|
||||
{
|
||||
if (coll.gameObject.tag == "Pizza")
|
||||
{
|
||||
Destroy(coll.gameObject);
|
||||
currentHealth += currentHealth < startHealth ? 1 : 0;
|
||||
healthBar.size = new Vector2(1.5f * currentHealth, this.healthBar.size.y);
|
||||
}
|
||||
else if (coll.gameObject.tag == "Coffee")
|
||||
{
|
||||
Destroy(coll.gameObject);
|
||||
DrinkCoffee();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrinkCoffee()
|
||||
{
|
||||
int result = currentStamina + GetStaminaValueChange(coffeValuePercent);
|
||||
currentStamina = result < startStamina ? result : startStamina;
|
||||
staminaBar.size = new Vector2(staminaBar.size.x * (currentStamina/startStamina), staminaBar.size.y);
|
||||
}
|
||||
|
||||
private void DecreaseStaminaAfterBugFight()
|
||||
{
|
||||
int result = currentStamina - GetStaminaValueChange(bugStaminaDamagePercent);
|
||||
currentStamina = result < 0 ? 0 : result;
|
||||
}
|
||||
|
||||
private int GetStaminaValueChange(int percentage)
|
||||
{
|
||||
return currentStamina < startStamina ? (startStamina * percentage / 100) : 0;
|
||||
}
|
||||
|
||||
|
||||
private void MovePlayer()
|
||||
{
|
||||
Jump();
|
||||
|
||||
@@ -43,7 +43,7 @@ TextureImporter:
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
alignment: 4
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 16
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- Pizza
|
||||
- Coffee
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user