public override void Attack()
    {
        GameObject       clone     = Instantiate(projectile, spawnPoint.position, spawnPoint.rotation);
        PlayerProjectile newBullet = clone.GetComponent <PlayerProjectile>();

        newBullet.Fire(transform.forward);
    }
Exemplo n.º 2
0
    void Fire()
    {
        GameObject       bullet     = Instantiate(bulletPrefab, rb.position + Vector2.up * bulletVerticalOffset, Quaternion.identity);
        PlayerProjectile projectile = bullet.GetComponent <PlayerProjectile>();

        projectile.Fire(lookDirection);
        // call animation for firing
    }
Exemplo n.º 3
0
    public void Fire()
    {
        int direction = 1;

        if (!isFacingRight)
        {
            direction = -1;
        }
        if (wallSliding)
        {
            direction *= -1;
        }
        GameObject bullet = Instantiate(bulletProjectile,
                                        this.transform.position + (new Vector3(direction * 0.5f, -0.08f, 0)),
                                        Quaternion.identity
                                        );
        PlayerProjectile projectile = bullet.GetComponent <PlayerProjectile>();

        projectile.Fire((int)direction);
        audioSource.PlayOneShot(fireSound);
        // call animation for firing
    }