void Awake()
 {
     currentHealth    = maxHealth;
     sphereCollider   = GetComponent <SphereCollider>();
     zombiePool       = FindObjectOfType <ZombiePool>();
     zombieController = GetComponent <ZombieController>();
     gameManager      = FindObjectOfType <GameManager>();
 }
Exemple #2
0
    public ZombieFactory(ZombieConfig config, MapData mapData, ZombiePool zombiePool,
                         ZombieAnimationQueue.Factory animationQueueFactory, ZombieCollection collection)
    {
        _animationQueueFactory = animationQueueFactory;
        _config     = config;
        _mapData    = mapData;
        _zombiePool = zombiePool;
        _collection = collection;

        _zombiesToSpawn = new Queue <Zombie>();
    }
Exemple #3
0
 protected override void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
     base.Awake();
 }
Exemple #4
0
    public ZombieCollection(ZombiePool pool, ZombieDiedSignal onZombieDiedSignal, UpdateZombieObjectsCountSignal updateZombieObjectsCountSignal,
                            LanguageChangedSignal languageChangedSignal)
    {
        _pool = pool;

        _onZombieDiedSignal = onZombieDiedSignal;
        _onUpdateZombieObjectsCountSignal = updateZombieObjectsCountSignal;
        _onLanguageChangedSignal          = languageChangedSignal;

        _zombieGameObjects       = new List <ZombieController>();
        _aliveCount              = 0;
        _zombiePhysicsForceTimer = null;
    }
Exemple #5
0
 void Start()
 {
     currentHealth      = initialHealth;
     zombiePool         = GameObject.Find("ZombieSpawner").GetComponent <ZombiePool>();
     animator           = GetComponent <Animator>();
     audioSource        = GetComponent <AudioSource>();
     capsuleCollider    = GetComponent <CapsuleCollider>();
     playerTransform    = GameObject.Find("Player").GetComponent <Transform>();
     playerController   = GameObject.Find("Player").GetComponent <PlayerController>();
     canvas             = GameObject.Find("Canvas");
     panel              = canvas.transform.Find("Panel").gameObject;
     navmeshAgent       = GetComponent <NavMeshAgent>();
     navmeshAgent.speed = walkingSpeed;
 }
Exemple #6
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
            //DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        pool = new Queue <GameObject>();
        Init();
    }
Exemple #7
0
    public ZombieManager(ZombieDiedSignal zombieDiedSignal, ZombiePool zombiePool,
                         ZombieFactory goFactory, GameConfig gameConfig, StartNewWaveSignal startNewWave,
                         WaveStartedSignal waveStarted, UpdateZombiesCountSignal onUpdateZombiesCountSignal,
                         NightManager nightManager, WindowsManager windowsManager, ZombieConfig zombieConfig,
                         TutorialManager tutorialManager, AnalyticsManager analyticsManager) : base("zombies.json")
    {
        _onZombieDiedSignal            = zombieDiedSignal;
        _onStartNewWaveSignal          = startNewWave;
        _onWaveStartedSignal           = waveStarted;
        _onUpdateZombiesCountSignal    = onUpdateZombiesCountSignal;
        _windowsManager                = windowsManager;
        _tutorialManager               = tutorialManager;
        _tutorialManager.ZombieManager = this;
        _analyticsManager              = analyticsManager;

        _zombiePool   = zombiePool;
        _GOfactory    = goFactory;
        _gameConfig   = gameConfig;
        _nightManager = nightManager;
        _zombieConfig = zombieConfig;

        _zombies = new List <Zombie>();
        _zombieCountBeforeBoss    = _gameConfig.waveSettings.startZombieCount;
        _currentZombieCount       = _zombieCountBeforeBoss;
        _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
        WaveNumber             = _gameConfig.waveSettings.startWave;
        _currentMainZombieType = ZombieType.Basic;
        _otherMainTypes        = new List <ZombieType>();
        _otherMainTypes.Add(ZombieType.Acid);
        _otherMainTypes.Add(ZombieType.Fire);
        _otherMainTypes.Add(ZombieType.Armor);
        _otherMainTypes.Add(ZombieType.Electro);

        _otherAddTypes = new List <ZombieType>();

        _hpPerZombie          = new InfInt();
        _currentDecadeStartHP = new InfInt(_gameConfig.waveSettings.firstWaveHP);
        _currentWaveHP        = new InfInt(_currentDecadeStartHP);

        _tempBigNumber = new InfInt();
        _tmpBigNumber  = new InfInt();

        _autoStartNewWave    = false;
        _waveStarted         = false;
        _timeTravelStartLock = false;
        _lastBossAlive       = false;
    }
    public static void ReturnEnemy(GameObject enemy, EnemyType enemyType)
    {
        switch (enemyType)
        {
        case EnemyType.Zombie:
            ZombiePool.GetInstance().ReturnToPool(enemy);
            break;

        case EnemyType.OrnamentTheif:
            OrnamentThiefPool.GetInstance().ReturnToPool(enemy);
            break;

        default:
            Debug.LogError("Something Went Wrong");
            break;
        }
    }
Exemple #9
0
 private void Awake()
 {
     Instance = this;
 }
Exemple #10
0
 private void Start()
 {
     zombiePool = ZombiePool.Instance;
     rigidBody  = GetComponent <Rigidbody>();
 }
Exemple #11
0
 void Awake()
 {
     instance = this;
 }
Exemple #12
0
 void Start()
 {
     zombiePool   = FindObjectOfType <ZombiePool>();
     zombieLookup = zombiePool.GetComponent <ZombieLookup>();
 }