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} character: {fileID: 1869821414}
overMind: {fileID: 1682053525} overMind: {fileID: 1682053525}
timeOnStart: 30 timeOnStart: 30
DeathScreen: {fileID: 0} DeathScreen: {fileID: 732765870}
--- !u!1 &1506820044 --- !u!1 &1506820044
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1341,9 +1341,11 @@ MonoBehaviour:
megaMob: {fileID: 0} megaMob: {fileID: 0}
pullSize: 20 pullSize: 20
characterObject: {fileID: 1869821414} characterObject: {fileID: 1869821414}
gamePlay: {fileID: 0}
mobMoveSpeed: 0.2 mobMoveSpeed: 0.2
mobHealth: 100 mobHealth: 100
mobDamage: 20 mobDamage: 20
mobAddedTime: 100
mobPull: {fileID: 679042026} mobPull: {fileID: 679042026}
activeMobs: {fileID: 1560770443} activeMobs: {fileID: 1560770443}
--- !u!4 &1682053527 --- !u!4 &1682053527

View File

@ -49,4 +49,9 @@ public float GetTimer()
{ {
return _time; 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 moveSpeed;
[SerializeField] private float health; [SerializeField] private float health;
[SerializeField] private float damage; [SerializeField] private float damage;
[SerializeField] private float mobAddedTime;
[SerializeField] private float minDist; [SerializeField] private float minDist;
[SerializeField] private float maxDist; [SerializeField] private float maxDist;
@ -36,7 +37,8 @@ void Update()
{ {
if (health <= 0) if (health <= 0)
{ {
overMind.DeathGoToPull(gameObject); mobAnimator.SetBool("IsDeath", true);
StartCoroutine(waiter());
} }
healthText.text = health.ToString(); healthText.text = health.ToString();
@ -94,19 +96,15 @@ void OnTriggerEnter2D(Collider2D col)
if (col.gameObject.CompareTag("Character")) if (col.gameObject.CompareTag("Character"))
{ {
characterObject.GetComponent<Character>().SendMessage("ApplyDamage", damage); characterObject.GetComponent<Character>().SendMessage("ApplyDamage", damage);
health = -1f;
mobAnimator.SetBool("IsDeath", true);
StartCoroutine(waiter());
//overMind.DeathGoToPull(gameObject);
} }
// Debug.Log("PIZDAAAAAA");
} }
IEnumerator waiter() IEnumerator waiter()
{ {
yield return new WaitForSecondsRealtime(0.5f); yield return new WaitForSecondsRealtime(0.5f);
overMind.DeathGoToPull(gameObject); overMind.DeathGoToPull(gameObject, mobAddedTime);
} }
public void SetupMob(OverMind.MobParameters mobParameters) public void SetupMob(OverMind.MobParameters mobParameters)

View File

@ -9,9 +9,11 @@ public class OverMind : MonoBehaviour
[SerializeField] private int pullSize; [SerializeField] private int pullSize;
[SerializeField] private GameObject characterObject; [SerializeField] private GameObject characterObject;
[SerializeField] private Gameplay gamePlay;
[SerializeField] private float mobMoveSpeed; [SerializeField] private float mobMoveSpeed;
[SerializeField] private float mobHealth; [SerializeField] private float mobHealth;
[SerializeField] private float mobDamage; [SerializeField] private float mobDamage;
[SerializeField] private float mobAddedTime;
[SerializeField] private GameObject mobPull; [SerializeField] private GameObject mobPull;
[SerializeField] private GameObject activeMobs; [SerializeField] private GameObject activeMobs;
@ -36,6 +38,7 @@ public struct MobParameters
public OverMind OverMind; public OverMind OverMind;
public float Health; public float Health;
public float Damage; public float Damage;
public float AddedTime;
} }
void Start() void Start()
@ -108,6 +111,7 @@ private void PreHeaterSpawn()
OverMind = this, OverMind = this,
Health = mobHealth, Health = mobHealth,
Damage = mobDamage, Damage = mobDamage,
AddedTime = mobAddedTime
}; };
newMob.GetComponent<Mob>().SetupMob(newMobParameters); 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.SetActive(false);
mob.transform.parent = mobPull.transform; mob.transform.parent = mobPull.transform;
} }