Beispiel #1
0
    private void SpawnZombie(Transform spawnPoint)
    {
        var controller = _zombiePool.GetZombieController();

        if (controller == null)
        {
            return;
        }

        ZombieSettings settings = _config.GetZombieSettings(_currentZombieToSpawn.Type, _currentZombieToSpawn.IsBoss);

        if (settings == null)
        {
            Debug.LogError("ZombieFactory SpawnZombie ZOMBIE SETTINGS IS NULL!!!");
            return;
        }

        _currentZombieToSpawn.SetSpeed(settings.GetSpeed());

        ZombieAnimationQueue queue = controller.HasAnimationQueue() ? null : _animationQueueFactory.Create();

        controller.UpdateInfo(_currentZombieToSpawn, spawnPoint.position, queue, _collection);
        _currentZombieToSpawn = null;
        _collection.OnGOCreated(controller);
    }
Beispiel #2
0
    public void UpdateInfo(Zombie model, Vector3 spawnPosition, ZombieAnimationQueue animationQueue, ZombieCollection collection)
    {
        //   Debug.Log(string.Format("{0} UpdateInfo", gameObject.name));

        if (animationQueue != null)
        {
            _animationQueue = animationQueue;
        }

        _collection = collection;
        _animationQueue.UpdateInfo(_view, _instanceId);
        _transform.position = spawnPosition;
        _model = model;
        _model.UpdateInfo(this);
        _zombieCollider.enabled = !_model.IsBoss;
        _bossCollider.enabled   = _model.IsBoss;

        if (_model.IsBoss)
        {
            _collider = _bossCollider;
        }
        else
        {
            _collider = _zombieCollider;
        }

        _view.UpdateInfo(model);
        _stateTimer = 0;
    }