public void InitTroopAs(TroopType type, int number) { HP = number * 10; _troopType = type; AntInstance.InitAnts(number); MoveInstance.Init(); FightInstance.Init(); }
public void TakeDamage(int damage) { HP -= damage; Debug.Log(gameObject.name + "take damage" + damage + "left" + HP); if (HP <= 0) { HP = 0; FightInstance.StopAttack(); PoolTotleMgr.Instance.Despawn(transform); } else { AntInstance.DespawnAntsWhenDamage(); } }
private void Awake() { if (Main) { LogMsg("Game Manager Singleton already exists in scene. Destroying copy at " + gameObject.name); Destroy(this); } Main = this; _instance = FindObjectOfType <FightInstance>(); if (_instance) { _player = _instance.Player; _currentBoss = _instance.InstanceBoss; FightInstance.OnBossDown += GameWin; } }