示例#1
0
    private IEnumerator ReturnObject()
    {
        yield return(new WaitForSeconds(16));

        AsteroidPool.ReturnObject(this);
        destroyAsteroid = null;
    }
 private void SubscribeToEvents(AsteroidPool asteroidPool)
 {
     foreach (Asteroid asteroid in asteroidPool.AllObjects)
     {
         asteroid.StateChanged += OnStateChanged;
     }
 }
示例#3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#4
0
 void Start()
 {
     particle    = GetComponent <ParticleSystem>();
     pool        = FindObjectOfType <AsteroidPool>();
     renderer    = GetComponent <MeshRenderer>();
     gameManager = FindObjectOfType <GameManager>();
     particle.Stop();
 }
    private IEnumerator TimerAsteroid()
    {
        yield return(new WaitForSeconds(delaySpawn));

        var asteroid = AsteroidPool.GetObject(GetPointAsteroid(), Vector3.down);

        StartCoroutine(TimerAsteroid());
    }
示例#6
0
    public void Death()
    {
        Destroy(gameObject);
        GameMaster   gm = GameObject.Find("GameMaster").GetComponent <GameMaster> ();
        AsteroidPool aP = GameObject.Find("GameMaster").GetComponent <AsteroidPool> ();

        gm.GameOver();
        aP.over = true;
    }
示例#7
0
 public static void RestartLevel()
 {
     instance.currentLevelType = null;
     instance.mainUi.HideEndPanel();
     instance.mainUi.ShowGamePanel();
     AsteroidPool.ClearAsteroid();
     instance.player.StartHealth();
     instance.player.transform.position = Vector3.zero;
     StartGame(instance.currentIndextLevel);
 }
示例#8
0
    public void Initialize()
    {
        if (!InitializeSingleton(this))
        {
            return;
        }

        TRexPool      = GetComponentInChildren <TRexPool>();
        AsteroidPool  = GetComponentInChildren <AsteroidPool>();
        PickupPool    = GetComponentInChildren <PickupPool>();
        QuicksandPool = GetComponentInChildren <QuicksandPool>();
    }
    private void Start()
    {
        pool = GetComponent <AsteroidPool>();
        StartGame();
        pool.SetSpawnActive(true);

        timer = timeToQuestions;

        currentLife = life;
        Spaceship.Instance.UpdateLifeBar(life, currentLife);
        UIController.UpdateLife(currentLife);
        UIController.UpdateScore(score);
    }
示例#10
0
 // 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));
 }
示例#11
0
        public void Init()
        {
            var projectilePools = GetComponentsInChildren <ProjectilePool>(true);

            foreach (var projectilePool in projectilePools)
            {
                if (!_projectilePools.Contains(projectilePool))
                {
                    _projectilePools.Add(projectilePool);
                }
            }

            foreach (var projectilePool in _projectilePools)
            {
                projectilePool.Init();
            }

            if (_asteroidPool == null)
            {
                _asteroidPool = GetComponentInChildren <AsteroidPool>();
            }
            _asteroidPool.Init();
        }
示例#12
0
 public void DestroyAsteroid()
 {
     AsteroidPool.ReturnObject(thisAsteroid);
 }
示例#13
0
 void Awake()
 {
     instance = this;
     CreatePool();
 }
示例#14
0
 private void Awake()
 {
     asteroidPool = this;
 }