Exemplo n.º 1
0
 /// <summary>
 /// Activates the weapon
 /// </summary>
 protected virtual void Shoot()
 {
     if (_numberOfShoots < 1)
     {
         _characterHandleWeapon.ShootStart();
         _numberOfShoots++;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Activates the weapon
        /// </summary>
        protected virtual void Shoot()
        {
            if (_numberOfShoots < 1)
            {
                TurnOnChargeEffect();
                PlaySfx();

                anim.speed = 2;
                _characterHandleWeapon.ShootStart();
                _numberOfShoots++;
            }
        }
Exemplo n.º 3
0
/// <summary>
/// Activates the weapon
/// </summary>
        protected virtual void Shoot() // only shoot if facing the same direction as the player
        {
            if (_numberOfShoots < 1)
            {
                if (this.transform.position.x > _brain.Target.position.x)
                {
                    if (GameObject.Find("BossModel").transform.localScale.x == 1)
                    {
                        _characterHandleWeapon.ShootStart();
                        _numberOfShoots++;
                    }
                }
                else
                {
                    if (GameObject.Find("BossModel").transform.localScale.x == -1)
                    {
                        _characterHandleWeapon.ShootStart();
                        _numberOfShoots++;
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected virtual IEnumerator PhaseAndShoot()
        {
            coroutineRunning = true;

            //_collider.enabled = true;

            yield return(new WaitForSeconds(2f)); //wait before shooting so animation lines up

            _characterShoot.enabled = true;
            _characterShoot.ShootStart(); //turn on weapon and right back off so that only one shot fires.

            StartCoroutine(PhaseOut());
        }
Exemplo n.º 5
0
        protected virtual IEnumerator DropProjectile()
        {
            _characterShoot.ShootStart();                               //Start shooter, ****weapon must have delay before firing****
            yield return(new WaitForSeconds(TimeItTakesToRotate));      //time it takes to flip roughly

            yield return(new WaitForSeconds(TimeUpsideDown));           //time to wait before rotating back.

            _characterShoot.ShootStop();                                //Turn off weapon
            _playerSpotted = false;                                     //disable spotted mode
            FlipBackMode   = true;                                      //enable flip back mode
            yield return(new WaitForSeconds(TimeItTakesToRotate * 3f)); //time it takes to flip plus some extra time to allow for a little hover mode.

            FlipBackMode    = false;
            _detectorActive = true;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Every frame, check for the player and try and kill it
        /// </summary>
        protected virtual void Update()
        {
            if ((_character == null) || (_characterShoot == null))
            {
                return;
            }

            if ((_character.ConditionState.CurrentState == CharacterStates.CharacterConditions.Dead) ||
                (_character.ConditionState.CurrentState == CharacterStates.CharacterConditions.Frozen))
            {
                _characterShoot.ShootStop();
                return;
            }

            // determine the direction of the raycast
            _direction = (_character.IsFacingRight) ? transform.right : -transform.right;

            // we cast a ray in front of the agent to check for a Player
            _raycastOrigin.x = _character.IsFacingRight ? transform.position.x + RaycastOriginOffset.x : transform.position.x - RaycastOriginOffset.x;
            _raycastOrigin.y = transform.position.y + RaycastOriginOffset.y;
            _raycast         = MMDebug.RayCast(_raycastOrigin, _direction, ShootDistance, TargetLayerMask, Color.yellow, true);

            // if the raycast has hit something, we shoot
            if (_raycast)
            {
                _characterShoot.ShootStart();
            }
            // otherwise we stop shooting
            else
            {
                _characterShoot.ShootStop();
            }

            if (_characterShoot.CurrentWeapon != null)
            {
                if (_characterShoot.CurrentWeapon.GetComponent <WeaponAim>() != null)
                {
                    if (LevelManager.Instance.Players[0] != null)
                    {
                        Vector3 direction = LevelManager.Instance.Players[0].transform.position - this.transform.position;
                        _characterShoot.CurrentWeapon.GetComponent <WeaponAim>().SetCurrentAim(direction);
                    }
                }
            }
        }