diff --git a/ldjam50/Assets/Scenes/SampleScene.unity b/ldjam50/Assets/Scenes/SampleScene.unity index 9a0d6f2..8df14fc 100644 --- a/ldjam50/Assets/Scenes/SampleScene.unity +++ b/ldjam50/Assets/Scenes/SampleScene.unity @@ -1004,7 +1004,7 @@ MonoBehaviour: character: {fileID: 1869821414} overMind: {fileID: 1682053525} timeOnStart: 30 - DeathScreen: {fileID: 0} + DeathScreen: {fileID: 732765870} --- !u!1 &1506820044 GameObject: m_ObjectHideFlags: 0 @@ -1341,9 +1341,11 @@ MonoBehaviour: megaMob: {fileID: 0} pullSize: 20 characterObject: {fileID: 1869821414} + gamePlay: {fileID: 0} mobMoveSpeed: 0.2 mobHealth: 100 mobDamage: 20 + mobAddedTime: 100 mobPull: {fileID: 679042026} activeMobs: {fileID: 1560770443} --- !u!4 &1682053527 diff --git a/ldjam50/Assets/Scripts/Gameplay.cs b/ldjam50/Assets/Scripts/Gameplay.cs index 0478d25..eabb7b1 100644 --- a/ldjam50/Assets/Scripts/Gameplay.cs +++ b/ldjam50/Assets/Scripts/Gameplay.cs @@ -49,4 +49,9 @@ public float GetTimer() { return _time; } + + public void AddTime(float addedTime) + { + _time += addedTime; + } } diff --git a/ldjam50/Assets/Scripts/Mob.cs b/ldjam50/Assets/Scripts/Mob.cs index 1a61b44..274ce1e 100644 --- a/ldjam50/Assets/Scripts/Mob.cs +++ b/ldjam50/Assets/Scripts/Mob.cs @@ -15,6 +15,7 @@ public class Mob : MonoBehaviour [SerializeField] private float moveSpeed; [SerializeField] private float health; [SerializeField] private float damage; + [SerializeField] private float mobAddedTime; [SerializeField] private float minDist; [SerializeField] private float maxDist; @@ -36,7 +37,8 @@ void Update() { if (health <= 0) { - overMind.DeathGoToPull(gameObject); + mobAnimator.SetBool("IsDeath", true); + StartCoroutine(waiter()); } healthText.text = health.ToString(); @@ -94,19 +96,15 @@ void OnTriggerEnter2D(Collider2D col) if (col.gameObject.CompareTag("Character")) { characterObject.GetComponent().SendMessage("ApplyDamage", damage); - - mobAnimator.SetBool("IsDeath", true); - StartCoroutine(waiter()); - //overMind.DeathGoToPull(gameObject); + health = -1f; } - // Debug.Log("PIZDAAAAAA"); - + } IEnumerator waiter() { yield return new WaitForSecondsRealtime(0.5f); - overMind.DeathGoToPull(gameObject); + overMind.DeathGoToPull(gameObject, mobAddedTime); } public void SetupMob(OverMind.MobParameters mobParameters) diff --git a/ldjam50/Assets/Scripts/OverMind.cs b/ldjam50/Assets/Scripts/OverMind.cs index 6a207d5..aa39bc5 100644 --- a/ldjam50/Assets/Scripts/OverMind.cs +++ b/ldjam50/Assets/Scripts/OverMind.cs @@ -9,9 +9,11 @@ public class OverMind : MonoBehaviour [SerializeField] private int pullSize; [SerializeField] private GameObject characterObject; + [SerializeField] private Gameplay gamePlay; [SerializeField] private float mobMoveSpeed; [SerializeField] private float mobHealth; [SerializeField] private float mobDamage; + [SerializeField] private float mobAddedTime; [SerializeField] private GameObject mobPull; [SerializeField] private GameObject activeMobs; @@ -36,6 +38,7 @@ public struct MobParameters public OverMind OverMind; public float Health; public float Damage; + public float AddedTime; } void Start() @@ -108,6 +111,7 @@ private void PreHeaterSpawn() OverMind = this, Health = mobHealth, Damage = mobDamage, + AddedTime = mobAddedTime }; newMob.GetComponent().SetupMob(newMobParameters); @@ -144,8 +148,9 @@ IEnumerator spawnMobsCourutine() } } - public void DeathGoToPull(GameObject mob) + public void DeathGoToPull(GameObject mob, float addedTime) { + gamePlay.AddTime(addedTime); mob.SetActive(false); mob.transform.parent = mobPull.transform; }