Exemplo n.º 1
0
 public void FollowPlayer()
 {
     Debug.Log("Following...");
     _agent.SetDestination(player.transform.position);
     if (stun.isStun == false)
     {
         _gun.Shoot();
     }
 }
Exemplo n.º 2
0
 public override void Update()
 {
     base.Update();
     //transform.LookAt(player.transform);
     if (selectedState == state.Shoot)
     {
         eg.Shoot();
     }
 }
Exemplo n.º 3
0
    IEnumerator ShootPlayer()
    {
        EnemyGun enemyGun = childTransform.gameObject.GetComponent <EnemyGun>();

        myTransform.LookAt(player);
        enemyGun.Shoot();
        yield return(new WaitForSeconds(shootingFrequency));

        myTransform.LookAt(player);
        enemyGun.Shoot();
        yield return(new WaitForSeconds(shootingFrequency));

        myTransform.LookAt(player);
        enemyGun.Shoot();
        yield return(new WaitForSeconds(shootingFrequency * 3));

        shooting = false;
        // EnemyGun shoots in the direction the enemy is facing
    }
Exemplo n.º 4
0
    private void Attack(Castle target)
    {
        _animator.speed = 1 / _attackDelay;
        _animator.Play("Attack");

        if (_miliAttackType)
        {
            target.TakeDamage(_damage);
        }
        else
        {
            _weapon.Shoot(_shootPoint);
        }
    }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     if (!seenPlayer && !shot)
     {
         Debug.DrawRay(this.gameObject.transform.position, this.transform.forward, Color.yellow, range);
         RaycastHit hit;
         if (!seenPlayer && Physics.Raycast(this.gameObject.transform.position, this.transform.forward, out hit, range, playerLayer))
         {
             seenPlayer = true;
             StartCoroutine(gun.Shoot());
         }
     }
     if (seenPlayer || shot)
     {
         nav.SetDestination(player.position);
     }
 }