예제 #1
0
    private IEnumerator BasicGreenTwoLineOne()
    {
        _generationDistanceCovered = 0;
        var spawnPositionOne = new Vector2(0, _spawnY);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        var enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());

        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        while (_generationDistanceCovered < BasicGeneration)
        {
            _generationDistanceCovered += Time.deltaTime * Globals.GlobalRatio * Globals.GameSpeed;
            yield return(new WaitForFixedUpdate());
        }

        _generationDistanceCovered = 0;

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;

        yield break;
    }
예제 #2
0
    private IEnumerator GreenBlueOne()
    {
        var position = new Vector2(0, _spawnY);

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(BoxEnemy, position, new Quaternion());

        _enemies.Add(enemy);

        _generationDistanceCovered = 0;
        while (_generationDistanceCovered < 1.5f * BasicGeneration)
        {
            _generationDistanceCovered += Time.deltaTime * Globals.GlobalRatio * Globals.GameSpeed;
            yield return(new WaitForFixedUpdate());
        }

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        enemy      = (GameObject)Instantiate(GreenEnemy, position, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;

        yield break;
    }
예제 #3
0
    private void UpdateWaiting()
    {
        _waitDistanceCovered += Time.deltaTime * Globals.GameSpeed;

        if (InBasic(_itemGenerating))
        {
            if (_waitDistanceCovered > BasicWait)
            {
                _state = CustomResources.AlphaGeneratorState.Generating;
            }
            return;
        }

        if (InTierTwo(_itemGenerating))
        {
            if (_waitDistanceCovered > BoxWait)
            {
                _state = CustomResources.AlphaGeneratorState.Generating;
            }

            return;
        }

        if (_waitDistanceCovered > CircleWait)
        {
            _state = CustomResources.AlphaGeneratorState.Generating;
        }
    }
예제 #4
0
    private IEnumerator CircleOne()
    {
        var position = new Vector2(0, _spawnY);

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());

        _enemies.Add(enemy);

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;
        yield break;
    }
예제 #5
0
    private IEnumerator Blue(int count)
    {
        var position = new Vector2(0, _spawnY);

        while (count-- > 0)
        {
            position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
            var enemy = (GameObject)Instantiate(BoxEnemy, position, new Quaternion());

            _enemies.Add(enemy);
        }

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;

        yield break;
    }
예제 #6
0
    private IEnumerator BasicGreenStraightTwo()
    {
        var spawnPositionOne = new Vector2(0, _spawnY);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        var enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());

        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;

        yield break;
    }
예제 #7
0
    public void Start()
    {
        _enemies                   = new List <GameObject>();
        _coins                     = new List <GameObject>();
        _state                     = CustomResources.AlphaGeneratorState.Waiting;
        _waitDistanceCovered       = 0;
        Globals.GameSpeed          = InitialGameSpeed;
        _isGenerating              = false;
        _hasStarted                = false;
        _generationDistanceCovered = 0f;
        _coinDistanceCovered       = 0f;
        _gameStartTimeLeft         = Globals.GameStartTime;
        _initialScoreMax           = ScoreMaxIncrement;
        _initialScoreMin           = ScoreMinIncrement;

        InitializeGenerationList();
        CalculateSpawnY();
        CalculateDestroyY();
        CalculateEdges();
    }
예제 #8
0
    private IEnumerator CircleTwo()
    {
        var position = new Vector2(0, _spawnY);

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());

        var circle = enemy.GetComponent <MagicCircleHandler>();

        circle.Clockwise = true;
        _enemies.Add(enemy);

        enemy            = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());
        circle           = enemy.GetComponent <MagicCircleHandler>();
        circle.Clockwise = false;
        _enemies.Add(enemy);

        _isGenerating = false;
        _state        = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted   = false;
        yield break;
    }
    private void UpdateWaiting()
    {
        _waitDistanceCovered += Time.deltaTime * Globals.GameSpeed;

        if (InBasic(_itemGenerating))
        {
            if (_waitDistanceCovered > BasicWait)
            {
                _state = CustomResources.AlphaGeneratorState.Generating;
            }
            return;
        }

        if (InTierTwo(_itemGenerating))
        {
            if (_waitDistanceCovered > BoxWait)
            {
                _state = CustomResources.AlphaGeneratorState.Generating;
            }

            return;
        }

        if (_waitDistanceCovered > CircleWait)
            _state = CustomResources.AlphaGeneratorState.Generating;
    }
    private IEnumerator CircleTwo()
    {
        var position = new Vector2(0, _spawnY);
        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());

        var circle = enemy.GetComponent<MagicCircleHandler>();
        circle.Clockwise = true;
        _enemies.Add(enemy);

        enemy = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());
        circle = enemy.GetComponent<MagicCircleHandler>();
        circle.Clockwise = false;
        _enemies.Add(enemy);

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;
        yield break;
    }
    private IEnumerator GreenBlueTwo()
    {
        var position = new Vector2(0, _spawnY);

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(BoxEnemy, position, new Quaternion());
        _enemies.Add(enemy);

        _generationDistanceCovered = 0;
        while (_generationDistanceCovered < BoxGeneration)
        {
            _generationDistanceCovered += Time.deltaTime * Globals.GlobalRatio * Globals.GameSpeed;
            yield return new WaitForFixedUpdate();
        }

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        enemy = (GameObject)Instantiate(GreenEnemy, position, new Quaternion());
        _enemies.Add(enemy);

        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        enemy = (GameObject)Instantiate(GreenEnemy, position, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;

        yield break;
    }
    private IEnumerator CircleOne()
    {
        var position = new Vector2(0, _spawnY);
        position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
        var enemy = (GameObject)Instantiate(CircleEnemy, position, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;
        yield break;
    }
    private IEnumerator Blue(int count)
    {
        var position = new Vector2(0, _spawnY);

        while (count-- > 0)
        {
            position.x = Random.Range(_leftEdge + 0.5f, _rightEdge - 0.5f);
            var enemy = (GameObject)Instantiate(BoxEnemy, position, new Quaternion());

            _enemies.Add(enemy);
        }

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;

        yield break;
    }
    private IEnumerator BasicGreenTwoLineTwo()
    {
        _generationDistanceCovered = 0;
        var spawnPositionOne = new Vector2(0, _spawnY);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        var enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        while (_generationDistanceCovered < BasicGeneration)
        {
            _generationDistanceCovered += Time.deltaTime * Globals.GlobalRatio * Globals.GameSpeed;
            yield return new WaitForFixedUpdate();
        }

        _generationDistanceCovered = 0;

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;

        yield break;
    }
    private IEnumerator BasicGreenStraightTwo()
    {
        var spawnPositionOne = new Vector2(0, _spawnY);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        var enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        spawnPositionOne.x = Random.Range(_leftEdge, _rightEdge);
        enemy = (GameObject)Instantiate(GreenEnemy, spawnPositionOne, new Quaternion());
        _enemies.Add(enemy);

        _isGenerating = false;
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _hasStarted = false;

        yield break;
    }
    public void Start()
    {
        _enemies = new List<GameObject>();
        _coins = new List<GameObject>();
        _state = CustomResources.AlphaGeneratorState.Waiting;
        _waitDistanceCovered = 0;
        Globals.GameSpeed = InitialGameSpeed;
        _isGenerating = false;
        _hasStarted = false;
        _generationDistanceCovered = 0f;
        _coinDistanceCovered = 0f;
        _gameStartTimeLeft = Globals.GameStartTime;
        _initialScoreMax = ScoreMaxIncrement;
        _initialScoreMin = ScoreMinIncrement;

        InitializeGenerationList();
        CalculateSpawnY();
        CalculateDestroyY();
        CalculateEdges();
    }