Ejemplo n.º 1
0
    private void LineAttack()
    {
        GameObject ghlostObj;
        float      timeTaken = Time.time - startTime;

        if (timeTaken < _lineCastTime)
        {
            //Rotates back and forth through the cone angle / 2 * -1 and 1
            float angle = Mathf.Sin(Time.time * _lineRotateSpeed) * ((_degreeOfCastCone / 2));
            gameObject.transform.LookAt(GetComponent <ShootingMiniBoss>().GetPlayerRef.gameObject.transform);
            transform.rotation = Quaternion.AngleAxis(angle + transform.eulerAngles.y, Vector3.up);

            //Spawns a new glhost based on the spawnrate
            if (timeTaken >= _lineSpawnRate * GhlostsCast)
            {
                //Debug.Log(timeTaken + " VS. " + _lineSpawnRate * GhlostsCast);
                GhlostsCast += 1;
                ghlostObj    = SpawnGhlost();
                ghlostObj.GetComponent <DumbGlhost>().GetSpeed = _lineGhlostTravelSpeed;
            }
        }
        else
        {
            _attackState = ATTACKSTATE.WAITFORATK;
            Debug.Log("Stop Casting");
        }
    }
Ejemplo n.º 2
0
    private void FindAttack()
    {
        Debug.Log("New Attack");
        GhlostsCast             = 0;
        _totalAttackPercentages = _pulseAttackPercentage + _spiralAttackPercentage + _lineAttackPercentage;
        float _nextAttack = Random.Range(0, _totalAttackPercentages);

        Debug.Log("Next attack: " + _nextAttack);
        if (_nextAttack > 0 && _nextAttack <= _pulseAttackPercentage)
        {
            Debug.Log("Pulse Attack");
            _attackState  = ATTACKSTATE.PULSEATK;
            _currentPulse = 0;
        }
        else if (_nextAttack > _pulseAttackPercentage && _nextAttack <= (_pulseAttackPercentage + _lineAttackPercentage))
        {
            Debug.Log("Line Attack");
            _startingAngle = transform.eulerAngles;
            _attackState   = ATTACKSTATE.LINEATK;
        }
        else
        {
            Debug.Log("Spiral Attack");
            _attackState = ATTACKSTATE.SPIRALATK;
        }
        startTime = Time.time;
    }
Ejemplo n.º 3
0
 public void MyReset()
 {
     _attackState = ATTACKSTATE.WAITFORATK;
     for (int index = 0; index < _ghlostsInScene.Count; index++)
     {
         GameObject ghlostRef;
         ghlostRef = _ghlostsInScene[index];
         _ghlostsInScene.Remove(ghlostRef);
     }
 }
Ejemplo n.º 4
0
 private void WaitForAttack()
 {
     if (newAttack == true)
     {
         newAttack        = false;
         attackInProgress = true;
         _attackState     = ATTACKSTATE.FINDATK;
     }
     else
     {
         attackInProgress = false;
     }
 }
Ejemplo n.º 5
0
    private void PulseAttack()
    {
        float timeTaken = Time.time - startTime;

        if (timeTaken > _pulseDelay * _currentPulse)
        {
            int        spacingAngle = 360 / _amountPerRing;
            GameObject ghlostObj;
            for (int i = 0; i < _amountPerRing; i++)
            {
                transform.eulerAngles += new Vector3(0, spacingAngle, 0);
                ghlostObj              = SpawnGhlost();
                ghlostObj.GetComponent <DumbGlhost>().GetSpeed = _pulseGhlostTravelSpeed;
            }
            _currentPulse++;
        }
        if (_currentPulse == _howManyPulses)
        {
            _attackState = ATTACKSTATE.WAITFORATK;
            Debug.Log("stop pulsing");
        }
    }
Ejemplo n.º 6
0
    private void spiralAttack()
    {
        GameObject ghlostObj;
        float      timeTaken = Time.time - startTime;

        if (timeTaken < _spiralCastTime)
        {
            transform.eulerAngles += new Vector3(0, 1 * _spiralRotateSpeed * Time.deltaTime, 0);

            if (timeTaken >= _spiralSpawnRate * GhlostsCast)
            {
                //Debug.Log(timeTaken + " VS. " + _spiralSpawnRate * GhlostsCast);
                GhlostsCast += 1;
                ghlostObj    = SpawnGhlost();
                ghlostObj.GetComponent <DumbGlhost>().GetSpeed = _spiralGhlostTravelSpeed;
            }
        }
        else
        {
            _attackState = ATTACKSTATE.WAITFORATK;
            Debug.Log("Stop Casting");
        }
    }
Ejemplo n.º 7
0
    private void PulseHardAttack()
    {
        float timeTaken = Time.time - startTime;

        if (timeTaken > _variedPulseDelay * _variedCurrentPulse)
        {
            int        spacingAngle = 360 / _variedAmountPerRing;
            GameObject ghlostObj;
            for (int i = 0; i < _variedAmountPerRing; i++)
            {
                transform.eulerAngles += new Vector3(0, spacingAngle + (spacingAngle / 2 * (_variedCurrentPulse % 2)), 0);
                //print(transform.rotation.ToString());
                ghlostObj = SpawnGhlost();
                //ghlostObj.GetComponent<BaseEnemy>().Init(gameObject.GetComponent<ShootingMiniBoss>().SetMyRoom, Mechanic.BOSS);
                ghlostObj.GetComponent <DumbGlhost>().GetSpeed = _variedGhlostTravelSpeed;
            }
            _variedCurrentPulse++;
        }
        if (_variedCurrentPulse == _variedHowManyPulses)
        {
            _attackState = ATTACKSTATE.WAITFORATK;
            Debug.Log("stop pulsing");
        }
    }