wip mob death time bonus

This commit is contained in:
dart 2022-04-03 14:15:29 +03:00
parent 0eabe14ee2
commit f28a56cc9e
4 changed files with 20 additions and 10 deletions

View File

@ -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

View File

@ -49,4 +49,9 @@ public float GetTimer()
{
return _time;
}
public void AddTime(float addedTime)
{
_time += addedTime;
}
}

View File

@ -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<Character>().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)

View File

@ -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<Mob>().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;
}