Ammo, wave gui, weapon staty, pilulky

This commit is contained in:
Kotrba Filip 2020-02-02 13:11:38 +01:00
parent efd1736239
commit b66ae414e3
13 changed files with 873 additions and 181 deletions

View File

@ -0,0 +1,157 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3435627263884782620
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3435627263884782622}
- component: {fileID: 3435627263884782623}
- component: {fileID: 3435627263884782617}
m_Layer: 0
m_Name: PillsObject
m_TagString: Interact
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3435627263884782622
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3435627263884782620}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.008133344, y: 1.265739, z: -2.023658}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8352172027178710535}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3435627263884782623
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3435627263884782620}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a26079dbac7f3cd4bacb95972241b8cb, type: 3}
m_Name:
m_EditorClassIdentifier:
blockType: 6
health: 30
healthRate: 15
amountModels: []
pills: {fileID: 5022562433003553812}
prefabPills: {fileID: 8423879596285337014, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
spawnPillsPoint: {x: 0.008133344, y: 1.265739, z: -2.023658}
audioSource: {fileID: 0}
doorSound: {fileID: 0}
--- !u!65 &3435627263884782617
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3435627263884782620}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.2, y: 0.4, z: 0.2}
m_Center: {x: 0, y: 0.15, z: 0}
--- !u!1001 &3554492602056808866
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 3435627263884782622}
m_Modifications:
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7843994914498914666, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 362f55bd6cc53b74dbd4f875ded5b5f1, type: 2}
- target: {fileID: 8423879596285337014, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
propertyPath: m_Name
value: painkillers
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 5689278253577398147, guid: d946f9dd565b97e49919fc8bd91aae4e, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: d946f9dd565b97e49919fc8bd91aae4e, type: 3}
--- !u!1 &5022562433003553812 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8423879596285337014, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
m_PrefabInstance: {fileID: 3554492602056808866}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8352172027178710535 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4808991200749645733, guid: d946f9dd565b97e49919fc8bd91aae4e,
type: 3}
m_PrefabInstance: {fileID: 3554492602056808866}
m_PrefabAsset: {fileID: 0}

View File

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

View File

@ -44,7 +44,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0} m_audioClip: {fileID: 0}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 1 m_Volume: 0.05
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 0
Mute: 0 Mute: 0
@ -141,8 +141,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
musicSource: {fileID: 5981860502065413816} musicSource: {fileID: 5981860502065413816}
DayMusic: {fileID: 0} DayMusic: {fileID: 8300000, guid: dbd637c87d6302e47b3dc18075b6de89, type: 3}
NightMusic: {fileID: 0} NightMusic: {fileID: 8300000, guid: 2565765545848aa4daee89afd5ea506b, type: 3}
Sun: {fileID: 0} Sun: {fileID: 0}
--- !u!1 &7985979212931499537 --- !u!1 &7985979212931499537
GameObject: GameObject:
@ -192,10 +192,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 885220d038aa1a6468127c63dd90a926, type: 3} m_Script: {fileID: 11500000, guid: 885220d038aa1a6468127c63dd90a926, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
speed: 10 speed: 5
runSpeed: 25 runSpeed: 10
rotateSpeed: 5 rotateSpeed: 5
mouseSensitive: 200 mouseSensitive: 50
buildRate: 0.5 buildRate: 0.5
health: 100 health: 100
actualHealth: 100 actualHealth: 100
@ -204,11 +204,14 @@ MonoBehaviour:
weaponList: weaponList:
- {fileID: 2179056336067526865, guid: 666835f3de085f9409e62598a45208bf, type: 3} - {fileID: 2179056336067526865, guid: 666835f3de085f9409e62598a45208bf, type: 3}
- {fileID: 2587956328074680696, guid: 4ce5febc0b514174abbed9882322d1ed, type: 3} - {fileID: 2587956328074680696, guid: 4ce5febc0b514174abbed9882322d1ed, type: 3}
- {fileID: 7279375804173823597, guid: f7f441e621e5e5f40b11b7617756a0af, type: 3}
spikes: {fileID: 1999182813209888360, guid: 7933df0606f61e94e9008c58a313b22c, type: 3} spikes: {fileID: 1999182813209888360, guid: 7933df0606f61e94e9008c58a313b22c, type: 3}
spikesImage: {fileID: 21300000, guid: 4962f21e920045b47be23a8e53f5716b, type: 3} spikesImage: {fileID: 21300000, guid: 4962f21e920045b47be23a8e53f5716b, type: 3}
handImage: {fileID: 21300000, guid: 53484c385de7af24a87aa73334775b28, type: 3} handImage: {fileID: 21300000, guid: 53484c385de7af24a87aa73334775b28, type: 3}
guiManager: {fileID: 0} guiManager: {fileID: 0}
selectedWeapon: 0 selectedWeapon: 0
audio: {fileID: 532783939}
lose: {fileID: 8300000, guid: 82c454fc5bd3770438a50747eec0fc06, type: 3}
--- !u!136 &7985979212931499551 --- !u!136 &7985979212931499551
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -251,7 +254,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0} m_audioClip: {fileID: 0}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 1 m_Volume: 0.5
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 0
Mute: 0 Mute: 0

View File

@ -51,8 +51,9 @@ MonoBehaviour:
spawnShoot: {fileID: 4234349944776735638} spawnShoot: {fileID: 4234349944776735638}
particleShoot: {fileID: 9220017394946394338, guid: 6480cbf8d57433a49b5d77875ceb391c, particleShoot: {fileID: 9220017394946394338, guid: 6480cbf8d57433a49b5d77875ceb391c,
type: 3} type: 3}
damage: 8 damage: 15
fireRate: 0.5 fireRate: 0.5
ammoCost: 2
animator: {fileID: 0} animator: {fileID: 0}
player: {fileID: 0} player: {fileID: 0}
hit: 0 hit: 0

View File

@ -66,11 +66,12 @@ MonoBehaviour:
particleShoot: {fileID: 0} particleShoot: {fileID: 0}
damage: 50 damage: 50
fireRate: 0.1 fireRate: 0.1
ammoCost: 2
animator: {fileID: 562605605} animator: {fileID: 562605605}
player: {fileID: 0} player: {fileID: 0}
hit: 0 hit: 0
audioSource: {fileID: 0} audioSource: {fileID: 0}
shootSound: {fileID: 0} shootSound: []
--- !u!1 &2587956328074680696 --- !u!1 &2587956328074680696
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -119,13 +120,14 @@ MonoBehaviour:
weaponRange: 2 weaponRange: 2
spawnShoot: {fileID: 0} spawnShoot: {fileID: 0}
particleShoot: {fileID: 0} particleShoot: {fileID: 0}
damage: 25 damage: 50
fireRate: 0.1 fireRate: 0.1
ammoCost: 2
animator: {fileID: 562605605} animator: {fileID: 562605605}
player: {fileID: 0} player: {fileID: 0}
hit: 0 hit: 0
audioSource: {fileID: 0} audioSource: {fileID: 0}
shootSound: {fileID: 0} shootSound: []
--- !u!1001 &8629712593250585003 --- !u!1001 &8629712593250585003
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -253,6 +253,9 @@ MonoBehaviour:
- {fileID: 8452048823607473439} - {fileID: 8452048823607473439}
- {fileID: 5205200862043998919} - {fileID: 5205200862043998919}
- {fileID: 4443642083919416725} - {fileID: 4443642083919416725}
pills: {fileID: 0}
prefabPills: {fileID: 0}
spawnPillsPoint: {x: 0, y: 0, z: 0}
audioSource: {fileID: 0} audioSource: {fileID: 0}
doorSound: {fileID: 0} doorSound: {fileID: 0}
--- !u!65 &8296172667468284673 --- !u!65 &8296172667468284673

File diff suppressed because it is too large Load Diff

View File

@ -787,6 +787,7 @@ MonoBehaviour:
Wood: {fileID: 863154880} Wood: {fileID: 863154880}
Ammo: {fileID: 802293425} Ammo: {fileID: 802293425}
healthBar: {fileID: 562374831} healthBar: {fileID: 562374831}
waves: {fileID: 0}
--- !u!1001 &591872493 --- !u!1001 &591872493
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -39,9 +39,9 @@ public class BarricadeManager : MonoBehaviour
public void addPlank() public void addPlank()
{ {
if (health < (barricadePlanks.Count * 35)) { if (health < (barricadePlanks.Count * 20)) {
audioSource.PlayOneShot(buildSound); audioSource.PlayOneShot(buildSound);
health += 35; health += 20;
offMeshLink.enabled = false; offMeshLink.enabled = false;
} }
} }
@ -59,7 +59,7 @@ public class BarricadeManager : MonoBehaviour
{ {
for (int i = 0; i < barricadePlanks.Count; i++) for (int i = 0; i < barricadePlanks.Count; i++)
{ {
if (i < (health / 35)) { if (i < (health / 20)) {
barricadePlanks[i].SetActive(true); barricadePlanks[i].SetActive(true);
} }
else else

View File

@ -10,6 +10,7 @@ public class DayManager : MonoBehaviour
public AudioSource mainSource = new AudioSource(); public AudioSource mainSource = new AudioSource();
public AudioClip dayClip; public AudioClip dayClip;
public AudioClip nigtClip; public AudioClip nigtClip;
public GuiManager guiManager;
public int daySurvived = 0; public int daySurvived = 0;
@ -22,6 +23,10 @@ public class DayManager : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (guiManager != null)
{
guiManager.setWave(daySurvived+1);
}
float sunRotationX = transform.localEulerAngles.x; float sunRotationX = transform.localEulerAngles.x;
sunRotationX = (sunRotationX > 180) ? sunRotationX - 360 : sunRotationX; sunRotationX = (sunRotationX > 180) ? sunRotationX - 360 : sunRotationX;
if (sunRotationX < 0 && !night) if (sunRotationX < 0 && !night)

View File

@ -9,6 +9,7 @@ public class GuiManager : MonoBehaviour
public Text Wood; public Text Wood;
public Text Ammo; public Text Ammo;
public Image healthBar; public Image healthBar;
public Text waves;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -35,4 +36,9 @@ public class GuiManager : MonoBehaviour
{ {
healthBar.fillAmount = health; healthBar.fillAmount = health;
} }
public void setWave(int wave)
{
waves.text = "Wave: " + wave;
}
} }

View File

@ -28,6 +28,10 @@ public class PlayerManager : MonoBehaviour
public int selectedWeapon = 0; public int selectedWeapon = 0;
private float selectRate = 1; private float selectRate = 1;
private float selectTime = 1; private float selectTime = 1;
public AudioSource audio;
public AudioClip lose;
private float nextMapeTime = 2;
private float nextMapeTime2 = 2;
// Start is called before the first frame update // Start is called before the first frame update
@ -58,7 +62,14 @@ public class PlayerManager : MonoBehaviour
if (actualHealth <= 0) if (actualHealth <= 0)
{ {
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single); if (audio != null && lose != null && (nextMapeTime2 + 1) <= Time.time)
{
audio.PlayOneShot(lose);
nextMapeTime2 = nextMapeTime + Time.time;
}
if (nextMapeTime2 <= Time.time) {
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
}
} }
float hpInPrcent = (actualHealth / (health / 100.0f)); float hpInPrcent = (actualHealth / (health / 100.0f));