End Menu with kills counts
This commit is contained in:
@@ -43,7 +43,7 @@ public class Ennemy : MonoBehaviour
|
||||
Destroy(gameObject);
|
||||
if (gameObject.name.Contains("Mayor"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().MayorKills++;
|
||||
GameManager.MayorKills++;
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
@@ -51,7 +51,7 @@ public class Ennemy : MonoBehaviour
|
||||
}
|
||||
else if (gameObject.name.Contains("Minautor"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().MinautorKills++;
|
||||
GameManager.MinautorKills++;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
GameObject _spawnedOrb = Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
@@ -60,7 +60,7 @@ public class Ennemy : MonoBehaviour
|
||||
}
|
||||
else if(gameObject.name.Contains("Bringer of Death"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().BringerOfDeathKills++;
|
||||
GameManager.BringerOfDeathKills++;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
GameObject _spawnedOrb = Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddfc85811f77bae4bb41e2fc9a765e36
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
// Kills stats
|
||||
public static int MayorKills = 0;
|
||||
public static int MinautorKills = 0;
|
||||
public static int BringerOfDeathKills = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4d49af84f4230742af671fc3a51668b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6306078675059866544
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 228442565381998639}
|
||||
- component: {fileID: 2308855536396030333}
|
||||
m_Layer: 0
|
||||
m_Name: Game Manager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &228442565381998639
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6306078675059866544}
|
||||
serializedVersion: 2
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2308855536396030333
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6306078675059866544}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4d49af84f4230742af671fc3a51668b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01a707e73fd604846880f6168cd45123
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -29,12 +29,6 @@ public class PlayerManager : MonoBehaviour
|
||||
public float laserOnX = 0f;
|
||||
public float laserOnY = 0f;
|
||||
|
||||
// Kills stats
|
||||
[Header("Kills Stats")]
|
||||
public int MayorKills = 0;
|
||||
public int MinautorKills = 0;
|
||||
public int BringerOfDeathKills = 0;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject pauseMenu;
|
||||
[SerializeField]
|
||||
@@ -66,6 +60,20 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// --- CHARACTER STATS ---------------------------------------------------------------------
|
||||
public void TakeDamage(int value)
|
||||
{
|
||||
Health -= value;
|
||||
if (Health <= 0)
|
||||
{
|
||||
Health = 0;
|
||||
|
||||
Time.timeScale = 0f;
|
||||
deathScreen.SetActive(true);
|
||||
deathScreen.GetComponent<DeathScreen>().ShowScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddExperience(int value)
|
||||
{
|
||||
Exp += value;
|
||||
@@ -80,20 +88,6 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// --- CHARACTER STATS ---------------------------------------------------------------------
|
||||
public void TakeDamage(int value)
|
||||
{
|
||||
Health -= value;
|
||||
if (Health <= 0)
|
||||
{
|
||||
Health = 0;
|
||||
|
||||
Time.timeScale = 0f;
|
||||
deathScreen.SetActive(true);
|
||||
deathScreen.GetComponent<DeathScreen>().ShowScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public void Heal()
|
||||
{
|
||||
Health += HealValue;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -295,6 +295,63 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 4ce1de8b166656e4a97422e7ac85530b, type: 3}
|
||||
--- !u!1001 &1566105705
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 228442565381998639, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6306078675059866544, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Game Manager
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 01a707e73fd604846880f6168cd45123, type: 3}
|
||||
--- !u!1001 &5393968438828368982
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -311,6 +368,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2777059098949019429, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_Alpha
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3552072345333957438, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
@@ -375,6 +436,10 @@ PrefabInstance:
|
||||
propertyPath: upgrades.upgrades.Array.size
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8536456763282141865, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8872681192320925159, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
@@ -453,3 +518,4 @@ SceneRoots:
|
||||
- {fileID: 5393968438828368982}
|
||||
- {fileID: 5921508570549303515}
|
||||
- {fileID: 1252793503}
|
||||
- {fileID: 1566105705}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class EndScene : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TMP_Text mayorsText, minautorsText, bringerOfDeathText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
mayorsText.SetText($"Mayors killed: {GameManager.MayorKills}");
|
||||
minautorsText.SetText($"Minautors killed: {GameManager.MinautorKills}");
|
||||
bringerOfDeathText.SetText($"Bringers of Death killed: {GameManager.BringerOfDeathKills}");
|
||||
}
|
||||
|
||||
public void RestartGame()
|
||||
{
|
||||
SceneManager.LoadScene("Game");
|
||||
}
|
||||
|
||||
public void MainMenu()
|
||||
{
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73dcebcb83cf76f4fadfcefd76100ba6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user