Repair spikes add health bar and change vizualization of info about amout of wood and ammo

This commit is contained in:
Kotrba Filip 2020-02-02 04:12:43 +01:00
parent ae9a9b51a0
commit 3e48e0aea5
32 changed files with 12086 additions and 5113 deletions

View File

@ -39,6 +39,9 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -5736350174949018188} m_State: {fileID: -5736350174949018188}
m_Position: {x: 270, y: 120, z: 0} m_Position: {x: 270, y: 120, z: 0}
- serializedVersion: 1
m_State: {fileID: 3193041202617100225}
m_Position: {x: 270, y: 60, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
@ -48,7 +51,7 @@ AnimatorStateMachine:
m_EntryPosition: {x: 50, y: 120, z: 0} m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -5736350174949018188} m_DefaultState: {fileID: 3193041202617100225}
--- !u!91 &9100000 --- !u!91 &9100000
AnimatorController: AnimatorController:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -63,7 +66,7 @@ AnimatorController:
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 0} m_Controller: {fileID: 9100000}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer
@ -77,6 +80,58 @@ AnimatorController:
m_IKPass: 0 m_IKPass: 0
m_SyncedLayerAffectsTiming: 0 m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1102 &3193041202617100225
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Nothing
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 4279847616519983088}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &4279847616519983088
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Hit
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5736350174949018188}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &7043675722454996173 --- !u!1101 &7043675722454996173
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

Binary file not shown.

Binary file not shown.

BIN
Assets/Models/torch.blend1 Normal file

Binary file not shown.

View File

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

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 874380372637160946} - component: {fileID: 874380372637160946}
- component: {fileID: 1908658187181555171} - component: {fileID: 1908658187181555171}
- component: {fileID: 1402357855717081948} - component: {fileID: 1402357855717081948}
- component: {fileID: -852646611413746892}
m_Layer: 0 m_Layer: 0
m_Name: Barricade m_Name: Barricade
m_TagString: Spikes m_TagString: Spikes
@ -48,7 +49,15 @@ MonoBehaviour:
blockType: 1 blockType: 1
health: 100 health: 100
healthRate: 5 healthRate: 5
amountModels: [] amountModels:
- {fileID: 6266030662392703044}
- {fileID: 3847955541176867416}
- {fileID: 965572206314881976}
- {fileID: 7799514952860760797}
- {fileID: 256051067918925093}
- {fileID: 3952444572634493808}
- {fileID: 4850250424701318178}
- {fileID: 9095210850575404026}
audioSource: {fileID: 0} audioSource: {fileID: 0}
doorSound: {fileID: 0} doorSound: {fileID: 0}
--- !u!208 &1402357855717081948 --- !u!208 &1402357855717081948
@ -61,12 +70,25 @@ NavMeshObstacle:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_Shape: 1 m_Shape: 1
m_Extents: {x: 0.5, y: 0.75, z: 1} m_Extents: {x: 0.5, y: 0.75, z: 0.5}
m_MoveThreshold: 0.1 m_MoveThreshold: 0.1
m_Carve: 0 m_Carve: 0
m_CarveOnlyStationary: 0 m_CarveOnlyStationary: 0
m_Center: {x: -0.05, y: 0.75, z: 1} m_Center: {x: -0.05, y: 0.75, z: 0.5}
m_TimeToStationary: 0.5 m_TimeToStationary: 0.5
--- !u!65 &-852646611413746892
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1999182813209888360}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1.5, z: 1}
m_Center: {x: -0.05, y: 0.75, z: 0.5}
--- !u!1001 &8380342326956505725 --- !u!1001 &8380342326956505725
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -215,3 +237,51 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 8380342326956505725} m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &6266030662392703044 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2502203975881118265, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &3847955541176867416 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4695666576454475813, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &965572206314881976 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -492420421572216379, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7799514952860760797 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -7462036371361415008, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &256051067918925093 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -594094835925579944, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &3952444572634493808 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -4425609515867240179, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &4850250424701318178 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -5259225927154676129, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}
--- !u!1 &9095210850575404026 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -8470045053010906745, guid: 528f4b131abb8f9498400c1cf4283eca,
type: 3}
m_PrefabInstance: {fileID: 8380342326956505725}
m_PrefabAsset: {fileID: 0}

View File

@ -88,7 +88,7 @@ NavMeshAgent:
m_Acceleration: 8 m_Acceleration: 8
avoidancePriority: 50 avoidancePriority: 50
m_AngularSpeed: 120 m_AngularSpeed: 120
m_StoppingDistance: 2 m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1 m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1 m_AutoBraking: 1
m_AutoRepath: 1 m_AutoRepath: 1

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -179,7 +179,7 @@ ParticleSystem:
startLifetime: startLifetime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0.2 scalar: 0.5
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -724,7 +724,7 @@ ParticleSystem:
serializedVersion: 6 serializedVersion: 6
enabled: 1 enabled: 1
type: 4 type: 4
angle: 25 angle: 15
length: 5 length: 5
boxThickness: {x: 0, y: 0, z: 0} boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 1 radiusThickness: 1

View File

@ -141,7 +141,9 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
musicSource: {fileID: 5981860502065413816} musicSource: {fileID: 5981860502065413816}
Music: {fileID: 8300000, guid: 2842b38130c2ae343b9372edad7281bf, type: 3} DayMusic: {fileID: 0}
NightMusic: {fileID: 0}
Sun: {fileID: 0}
--- !u!1 &7985979212931499537 --- !u!1 &7985979212931499537
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -344,6 +346,7 @@ GameObject:
- component: {fileID: 7985979213387740674} - component: {fileID: 7985979213387740674}
- component: {fileID: 7985979213387740677} - component: {fileID: 7985979213387740677}
- component: {fileID: 7985979213387740676} - component: {fileID: 7985979213387740676}
- component: {fileID: 42642414}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Main Camera
m_TagString: MainCamera m_TagString: MainCamera
@ -375,7 +378,7 @@ Camera:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0.21573514, g: 0.30793875, b: 0.4528302, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2 m_GateFitMode: 2
m_FOVAxisMode: 0 m_FOVAxisMode: 0
@ -416,3 +419,63 @@ AudioListener:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7985979213387740679} m_GameObject: {fileID: 7985979213387740679}
m_Enabled: 1 m_Enabled: 1
--- !u!114 &42642414
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7985979213387740679}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTrigger: {fileID: 7985979213387740674}
volumeLayer:
serializedVersion: 2
m_Bits: 1048576
stopNaNPropagation: 1
finalBlitToCameraTarget: 0
antialiasingMode: 1
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
keepAlpha: 0
fog:
enabled: 1
excludeSkybox: 1
debugLayer:
lightMeter:
width: 512
height: 256
showCurves: 1
histogram:
width: 512
height: 256
channel: 3
waveform:
exposure: 0.12
height: 256
vectorscope:
size: 256
exposure: 0.12
overlaySettings:
linearDepth: 0
motionColorIntensity: 4
motionGridSize: 64
colorBlindnessType: 0
colorBlindnessStrength: 1
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
m_ShowToolkit: 0
m_ShowCustomSorter: 0
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeStackBundles: []
m_AfterStackBundles: []

View File

@ -14,6 +14,22 @@ CapsuleCollider:
m_Height: 60 m_Height: 60
m_Direction: 2 m_Direction: 2
m_Center: {x: 0, y: 0, z: 29} m_Center: {x: 0, y: 0, z: 29}
--- !u!208 &4623503337842674502
NavMeshObstacle:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2104789401984237560}
m_Enabled: 1
serializedVersion: 3
m_Shape: 1
m_Extents: {x: 1.697, y: 1.697, z: 34.888}
m_MoveThreshold: 0.1
m_Carve: 0
m_CarveOnlyStationary: 1
m_Center: {x: 0, y: 0, z: 36.371002}
m_TimeToStationary: 0.5
--- !u!1 &7706219202001118132 --- !u!1 &7706219202001118132
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -24,7 +40,6 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 6132983532685291387} - component: {fileID: 6132983532685291387}
- component: {fileID: 792143903499247558} - component: {fileID: 792143903499247558}
- component: {fileID: 7073027306475143712}
m_Layer: 0 m_Layer: 0
m_Name: Tree_LOD m_Name: Tree_LOD
m_TagString: Untagged m_TagString: Untagged
@ -95,22 +110,6 @@ LODGroup:
- renderer: {fileID: 3790753686469841987} - renderer: {fileID: 3790753686469841987}
- renderer: {fileID: 7477384831301876712} - renderer: {fileID: 7477384831301876712}
m_Enabled: 1 m_Enabled: 1
--- !u!208 &7073027306475143712
NavMeshObstacle:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7706219202001118132}
m_Enabled: 1
serializedVersion: 3
m_Shape: 0
m_Extents: {x: 0.28, y: 2.5, z: 0.28}
m_MoveThreshold: 0.1
m_Carve: 0
m_CarveOnlyStationary: 1
m_Center: {x: 0, y: 2.29, z: 0}
m_TimeToStationary: 0.5
--- !u!1001 &6890689231084320501 --- !u!1001 &6890689231084320501
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -119,7 +119,7 @@ MonoBehaviour:
weaponRange: 2 weaponRange: 2
spawnShoot: {fileID: 0} spawnShoot: {fileID: 0}
particleShoot: {fileID: 0} particleShoot: {fileID: 0}
damage: 50 damage: 25
fireRate: 0.1 fireRate: 0.1
animator: {fileID: 562605605} animator: {fileID: 562605605}
player: {fileID: 0} player: {fileID: 0}

5262
Assets/Prefabs/torch.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,7 @@ public class BlockManager : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
SpikeHit();
if (blockType == BlockType.Wood) if (blockType == BlockType.Wood)
{ {
if (health < 100 && healthTime < Time.time) if (health < 100 && healthTime < Time.time)
@ -133,18 +134,26 @@ public class BlockManager : MonoBehaviour
} }
} }
void OnCollisionEnter(Collision collision) void SpikeHit()
{ {
if (blockType == BlockType.Barricade) { if (blockType == BlockType.Barricade) {
Debug.Log(collision.transform.tag); RaycastHit hit;
if (collision.transform.CompareTag("Enemy")) if (Physics.BoxCast(this.transform.position + new Vector3(-0.05f, 0.75f, 1.0f), new Vector3(0.5f, 0.75f, 1.0f), this.transform.forward, out hit, transform.rotation,1.0f))
{ {
EnemyManager enemyManager = collision.transform.GetComponent<EnemyManager>(); if (hit.collider.CompareTag("Enemy"))
{
EnemyManager enemyManager = hit.collider.transform.GetComponent<EnemyManager>();
if (enemyManager != null) if (enemyManager != null)
{ {
enemyManager.Damage(100); enemyManager.Damage(100);
health = 0; health = 0;
Destroy(this.gameObject, 3); for (int i = 0; i < amountModels.Count; i++)
{
amountModels[i].transform.parent = null;
Destroy(amountModels[i], 4);
}
Destroy(this.gameObject);
}
} }
} }
} }

View File

@ -10,6 +10,8 @@ public class EnemyManager : MonoBehaviour
public float attackRate = 2; public float attackRate = 2;
private float attackTime = 2; private float attackTime = 2;
public float actualHealth; public float actualHealth;
public float findRate = 1;
private float findTime = 1;
private NavMeshAgent navMeshAgent; private NavMeshAgent navMeshAgent;
private PlayerManager player; private PlayerManager player;
public BarricadeManager barricadeManager; public BarricadeManager barricadeManager;
@ -18,6 +20,7 @@ public class EnemyManager : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
findTime = findRate;
attackTime = attackRate; attackTime = attackRate;
actualHealth = health; actualHealth = health;
player = FindObjectOfType<PlayerManager>(); player = FindObjectOfType<PlayerManager>();
@ -35,19 +38,19 @@ public class EnemyManager : MonoBehaviour
DestroyBarricades(); DestroyBarricades();
Attack(); Attack();
if (navMeshAgent != null && barricadeManager == null) if (navMeshAgent != null && barricadeManager == null && findTime < Time.time)
{ {
navMeshAgent.SetDestination(player.transform.position); navMeshAgent.SetDestination(player.transform.position);
findTime = findRate + Time.time;
} }
else if (navMeshAgent != null && barricadeManager != null) else if (navMeshAgent != null && barricadeManager != null && findTime < Time.time)
{ {
navMeshAgent.SetDestination(new Vector3(barricadeManager.walkPoint.position.x, 0, barricadeManager.walkPoint.position.z)); navMeshAgent.SetDestination(barricadeManager.transform.position);
findTime = findRate + Time.time;
} }
} }
void FixedUpdate() void FixedUpdate()
{
if (navMeshAgent != null && navMeshAgent.pathStatus == NavMeshPathStatus.PathComplete)
{ {
if (actualHealth > 0 && barricadeManager == null) if (actualHealth > 0 && barricadeManager == null)
{ {
@ -62,7 +65,6 @@ public class EnemyManager : MonoBehaviour
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(_dir), 5 * Time.deltaTime); transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(_dir), 5 * Time.deltaTime);
} }
} }
}
public void Damage(float damageLoc = 0) public void Damage(float damageLoc = 0)
{ {
@ -83,6 +85,7 @@ public class EnemyManager : MonoBehaviour
NavMeshPath path = new NavMeshPath(); NavMeshPath path = new NavMeshPath();
if (navMeshAgent != null) { if (navMeshAgent != null) {
navMeshAgent.CalculatePath(player.transform.position, path); navMeshAgent.CalculatePath(player.transform.position, path);
Debug.Log(path.status);
if (path.status == NavMeshPathStatus.PathPartial) if (path.status == NavMeshPathStatus.PathPartial)
{ {
BarricadeManager[] barricadeManagers = GameObject.FindObjectsOfType<BarricadeManager>(); BarricadeManager[] barricadeManagers = GameObject.FindObjectsOfType<BarricadeManager>();
@ -94,8 +97,14 @@ public class EnemyManager : MonoBehaviour
} }
else else
{ {
if (localBarricadeManager.health < barricadeManager.health || Vector3.Distance(barricadeManager.transform.position, transform.position) > Vector3.Distance(localBarricadeManager.transform.position, transform.position)) { if (localBarricadeManager.health < barricadeManager.health) {
barricadeManager = localBarricadeManager; barricadeManager = localBarricadeManager;
continue;
}
if (Vector3.Distance(barricadeManager.transform.position, transform.position) > Vector3.Distance(localBarricadeManager.transform.position, transform.position))
{
barricadeManager = localBarricadeManager;
continue;
} }
} }
} }
@ -197,19 +206,4 @@ public class EnemyManager : MonoBehaviour
} }
} }
} }
void OnCollisionEnter(Collision collision)
{
if (collision.transform.CompareTag("Spikes"))
{
BlockManager blockManager = GetComponent<Collider>().transform.GetComponent<BlockManager>();
if (blockManager != null && blockManager.blockType == BlockManager.BlockType.Barricade)
{
Damage(100);
blockManager.health = 0;
Destroy(blockManager);
Destroy(blockManager.gameObject, 3);
}
}
}
} }

View File

@ -8,6 +8,7 @@ public class GuiManager : MonoBehaviour
public GameObject InteractIcon; public GameObject InteractIcon;
public Text Wood; public Text Wood;
public Text Ammo; public Text Ammo;
public Image healthBar;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -29,4 +30,9 @@ public class GuiManager : MonoBehaviour
InteractIcon.GetComponent<Image>().sprite = image; InteractIcon.GetComponent<Image>().sprite = image;
} }
} }
public void SetHealth(float health)
{
healthBar.fillAmount = health;
}
} }

View File

@ -56,6 +56,9 @@ public class PlayerManager : MonoBehaviour
{ {
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single); SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
} }
float hpInPrcent = (actualHealth / (health / 100.0f));
guiManager.SetHealth((1.0f / 100.0f) * hpInPrcent);
} }
void FixedUpdate() void FixedUpdate()
@ -223,11 +226,12 @@ public class PlayerManager : MonoBehaviour
BlockManager blockManager = hit.transform.GetComponent<BlockManager>(); BlockManager blockManager = hit.transform.GetComponent<BlockManager>();
blockManager.Action(); blockManager.Action();
} }
else if (hit.transform.gameObject.layer == LayerMask.NameToLayer("BuildPlace") && Input.GetKeyDown(KeyCode.E) && buildTime < Time.time) else if (hit.transform.gameObject.layer == LayerMask.NameToLayer("BuildPlace") && Input.GetKeyDown(KeyCode.E) && buildTime < Time.time && barricadeMaterials > 0)
{ {
BlockManager blockManager = spikes.GetComponent<BlockManager>(); BlockManager blockManager = spikes.GetComponent<BlockManager>();
if (blockManager != null) if (blockManager != null)
{ {
barricadeMaterials-=3;
Instantiate<GameObject>(spikes, hit.point, transform.rotation); Instantiate<GameObject>(spikes, hit.point, transform.rotation);
buildTime = buildRate + Time.time; buildTime = buildRate + Time.time;
} }

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: adcab70c6db28d648922f97e27d1c41b
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: Sheila Crayon
fontNames:
- Sheila Crayon
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 9c3e1b96b409d274fa493ff710441985
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: aca2defce6c6d644bb6e1a60a2ddae23
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 0afbe6d181e85ec46b1903b8302694dc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: