Exemplo n.º 1
0
    public void EnemyShooting()
    {
        //Disparo enemigo
        FireBall newFireBall = Instantiate(_fireShoot);

        newFireBall.transform.position = _shootPoint.transform.position;
        newFireBall.GetComponent <Rigidbody2D>().AddForce(Vector2.right * -this.transform.localScale.x * _shootForce, ForceMode2D.Impulse);
        newFireBall.SetDamage(_fireBallDamage);
    }
Exemplo n.º 2
0
    void Fire()
    {
        FireBall newFireBall = Instantiate(_fireShoot);

        newFireBall.transform.position = _shootPoint.transform.position;
        Vector2 _playerPosition = (_player.transform.position + correction) - _shootPoint.transform.position;

        newFireBall.GetComponent <Rigidbody2D>().AddForce(_playerPosition * _shootForce, ForceMode2D.Impulse);
        newFireBall.SetDamage(_fireBallDamage);
    }
Exemplo n.º 3
0
        public void Shooting()
        {
            FireBall newFireBall = Instantiate(_fireShoot);

            newFireBall.transform.position   = _shootPoint.transform.position;
            newFireBall.transform.localScale = this.transform.localScale;
            AudioSource.PlayClipAtPoint(_shootClip, this.transform.position);
            newFireBall.GetComponent <Rigidbody2D>().AddForce(Vector2.right * this.transform.localScale.x * _shootForce, ForceMode2D.Impulse);
            newFireBall.SetDamage(_fireBallDamage);
        }
Exemplo n.º 4
0
 public void SpawnFireBall()
 {
     if (fireBall != null)
     {
         GameObject ball = Instantiate(fireBall, transform.position, Quaternion.identity);
         FireBall   fir  = ball.GetComponent <FireBall>();
         Transform  t    = FindClosestTarget();
         fir.SetDamage(damage);
         if (t != null)
         {
             // note t may be destroyed
             fir.SetDirection(-(transform.position - t.position));
         }
     }
 }
Exemplo n.º 5
0
    IEnumerator Attack()
    {
        playerState = PlayerState.Attack;
        animator.SetTrigger("Attack");
        isCanAttack = false;
        FireBall fireBall = Instantiate(fireBallPrefab, firePoint.position, Quaternion.identity);

        fireBall.SetDamage(damage);
        float tempAttackColdTime = 0;

        while (tempAttackColdTime < attackColdDown)
        {
            tempAttackColdTime += Time.deltaTime;
            yield return(0);
        }

        isCanAttack = true;
    }