Esempio n. 1
0
 private void Attacking()
 {
     if (_attachedShooter.attackInProgress != true)
     {
         _MyState    = SHOOTERSTATES.STUNNED;
         _startTimer = Time.time;
     }
 }
Esempio n. 2
0
    private void AbsorbAtk()
    {
        _rotationAngle       += 1 * _rotateSpeed * Time.deltaTime;
        transform.eulerAngles = new Vector3(0, transform.eulerAngles.y + _rotationAngle, 0);
        if (_invinciblesAddad == false)
        {
            for (int index = 0; index < _attachedShooter.GetGhlostsInScene.Count; index++)
            {
                if (_attachedShooter.GetGhlostsInScene[index].GetComponent <DumbBossGlhost>().GetMyMechanic == Mechanic.CHASE)
                {
                    DumbBossGlhost ghlostRef = _attachedShooter.GetGhlostsInScene[index].GetComponent <DumbBossGlhost>();
                    ghlostRef.GetSpeed = _absorbSpeed;
                    ghlostRef.setMove(transform.eulerAngles);
                    _absorbingGhlosts.Add(_attachedShooter.GetGhlostsInScene[index]);
                }
            }

            /*
             * Debug.DrawRay(transform.position + (Vector3.up * 1f), (transform.forward * 100f), Color.green);
             * if (Physics.Raycast(transform.position + (Vector3.up * 1f), transform.forward, out hit, 100f))
             * {
             *
             *  //transform.eulerAngles += new Vector3(0, angle, 0);
             *  if (hit.collider.GetComponent<DumbBossGlhost>())
             *  {
             *      if (hit.collider.GetComponent<DumbBossGlhost>().GetMyMechanic == Mechanic.CHASE)
             *      {
             *          for (int i = 0; i < _absorbingGhlo`sts.Count; i++)
             *          {
             *              if (hit.collider.gameObject == _absorbingGhlosts[i])
             *              {
             *                  return;
             *              }
             *          }
             *          DumbBossGlhost ghlostRef = hit.collider.GetComponent<DumbBossGlhost>();
             *          ghlostRef.GetSpeed = _absorbSpeed;
             *          ghlostRef.setMove(transform.eulerAngles);
             *          _absorbingGhlosts.Add(ghlostRef.gameObject);
             *      }
             *  }
             *
             * }
             */
            _invinciblesAddad = true;
        }
        else if (_absorbingGhlosts.Count != _absorbedGhlosts.Count)
        {
            _rotationAngle       += 1 + _rotateSpeed * Time.deltaTime;
            transform.eulerAngles = new Vector3(0, _rotationAngle, 0);
        }
        else if (_absorbingGhlosts.Count == _absorbedGhlosts.Count)
        {
            _ghlostsShot = 0;
            _MyState     = SHOOTERSTATES.SHOOT;
            _startTimer  = Time.time;
        }
    }
Esempio n. 3
0
    private void Stunned()
    {
        float timeTaken = Time.time - _startTimer;

        if (timeTaken >= _stunnedTime)
        {
            _MyState    = SHOOTERSTATES.FOLLOWING;
            _startTimer = Time.time;
        }
    }
Esempio n. 4
0
 private void CheckForCanAbsorb()
 {
     for (int ghlost = 0; ghlost < _attachedShooter.GetGhlostsInScene.Count; ghlost++)
     {
         if (_attachedShooter.GetGhlostsInScene[ghlost].GetComponent <DumbBossGlhost>().GetSpeed != 0)
         {
             return;
         }
     }
     _invinciblesAddad = false;
     _MyState          = SHOOTERSTATES.ABSORB;
 }
Esempio n. 5
0
    //Reset function
    public override void MyReset()
    {
        if (_init)
        {
            _attachedShooter.MyReset();
            gameObject.SetActive(true);
            _myRenderer.enabled      = true;
            _myColor.a               = 1;
            _myMaterial.color        = _myColor;
            _myRenderer.materials[1] = _myMaterial;

            _enemyAgent.enabled = false;
            Debug.Log("Boss Reset");
            transform.position = _startPos;
            transform.rotation = _startRot;

            /*
             * _enemiesToCrush.SetActive(true);
             * for (int i = 0; i < _GlhostsUnderMe.Count; i++)
             * {
             *  _GlhostsUnderMe[i].ResetCutscene();
             * }
             */
            _currBossHealth = _actualMaxHealth;
            _laggedBossHealthBar.fillAmount = 1;
            _actualBossHealthBar.fillAmount = 1;

            _bossBar.SetActive(false);
            _cameraInPosition = false;
            //_fallFinished = false;
            //_turnToPlayerFinished = false;
            //_glhostsCrushed = false;

            _endingPlaying  = false;
            _laggingHealth  = false;
            _updatingHealth = false;
            _dead           = false;
            _amHit          = false;
            _invincible     = false;

            _myAI    = BossAI.NONE;
            _MyState = SHOOTERSTATES.FOLLOWING;
            _init    = false;
        }
    }
Esempio n. 6
0
    private void FollowPlayer()
    {
        _enemyAgent.SetDestination(_playerRef.transform.position);
        float timeTaken = Time.time - _startTimer;

        //Debug.Log("following");

        if (timeTaken > _realFollowDuration)
        {
            _enemyAgent.SetDestination(transform.position);

            _attachedShooter.newAttack        = true;
            _attachedShooter.attackInProgress = true;
            _MyState = SHOOTERSTATES.ATTACKING;
        }

        for (int i = 0; i <= _numOfCasts; i++)
        {
            float Xpos = Mathf.Cos(_calcAngle * Mathf.Deg2Rad) * _bossCollisionDetectDistance;
            float Zpos = Mathf.Sin(_calcAngle * Mathf.Deg2Rad) * _bossCollisionDetectDistance;

            Vector3 RayDir = (transform.forward * Zpos) + (transform.right * Xpos);

            if (_debug)
            {
                Debug.DrawRay(transform.position + (Vector3.up * _vertDetectOffset), RayDir * _bossCollisionDetectDistance, Color.red);
            }

            _calcAngle += _detectionAngle / _numOfCasts;

            if (Physics.Raycast(transform.position + (Vector3.up * _vertDetectOffset), RayDir, out hit, _bossCollisionDetectDistance))
            {
                if (hit.collider.GetComponent <PlayerController>())
                {
                    hit.collider.GetComponent <PlayerController>().TakeDamage(_bossDamage);
                }
            }
        }

        _calcAngle = _startAngle;
    }
Esempio n. 7
0
    private void ShootAtPlayer()
    {
        if (_ghlostsShot < _absorbedGhlosts.Count)
        {
            float timeTaken = Time.time - _startTimer;
            gameObject.transform.LookAt(_playerRef.transform);

            //Spawns a new glhost based on the spawnrate
            if (timeTaken >= _shootRate * _ghlostsShot)
            {
                DumbBossGlhost ghlostRef = _absorbedGhlosts[_ghlostsShot].GetComponent <DumbBossGlhost>();
                ghlostRef.gameObject.SetActive(true);
                ghlostRef.setMove(_playerRef.transform.position);
                _ghlostsShot++;
            }
            Debug.Log("Shooting Ghlosts");
        }
        else
        {
            _MyState = SHOOTERSTATES.STUNNED;
        }
    }