private void Awake() { if (Instance == null) { Instance = this; } }
private void SpawnBoss() { BossPool bp = room.GetBossPool(); GameObject obj = Instantiate(prefabBoss, transform); obj.transform.localPosition = Vector3.zero; obj.GetComponent <TimeScale>().SetData(room.GetTimeScale()); Health health = obj.GetComponent <Health>(); health.Died += room.FinishRoom; health.Died += bp.OnDifficultyIncreased; health.Died += room.IncrementBossesKilled; bossHealthMeter.SetHealth(health); Boss boss = obj.GetComponent <Boss>(); boss.SetData(bp.GetRandomBoss()); boss.SetRoom(room); }
// Use this for initialization void Start() { //InvokeRepeating("SpawnHazards", 2, 3); isGameOver = false; ui = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>(); AsteroidP = GetComponent <AsteroidPool>(); EffectP = GetComponent <EffectPool>(); EnemyP = GetComponent <EnemyPool>(); ItemP = GetComponent <ItemPool>(); BossP = GameObject.FindGameObjectWithTag("BossPool").GetComponent <BossPool>(); Player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); CurrentLifeCount = StartLifeCount; ui.SetLife(CurrentLifeCount); ItemSpawnCount = 0; IsBossAlive = false; CurrentBossSpawnCount = BossSpawnCount; harzardRoutine = StartCoroutine(Hazards(StartWaitingTime, StageTimeGap)); }
public void Initialize(BossPool bossPool, MinionPool minionPool) { _bossPool = bossPool; _minionPool = minionPool; _leftPositions = _leftPositionsRaw.Select(x => x.position).ToArray(); _rightPositions = _rightPositionsRaw.Select(x => x.position).ToArray(); MessageManager.ReceiveEvent <PlayerDamagedEvent>().Subscribe(ev => { if (ev.Source.Type == EnemyType.Boss) { _bossPool.Despawn(ev.Source); } else { _minionPool.Despawn(ev.Source); } }); }
public void SetBossPool(BossPool val) { bossPool = val; }