Beispiel #1
0
    public void shootStake()
    {
        GameObject mineStake = Instantiate(stakePrefab);

        mineStake.GetComponent <StakeControl>().setStake(bulletDamage);
        mineStake.transform.position = gameObject.transform.position;
        LinealProjectile projectile = mineStake.GetComponent <LinealProjectile>();

        projectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
        projectile.setRotation(GetComponentInParent <PlayerAiming>().AimDirection.normalized);
        projectile.Velocity = GetComponentInParent <PlayerAiming>().AimDirection.normalized;

        StartCoroutine(fire(_fireRate));
    }
Beispiel #2
0
    private void shootBullet()
    {
        Vector2 direction = _target.transform.position - transform.position;

        direction.Normalize();

        GameObject mineStake = Instantiate(_bullet, _firePoint.position, Quaternion.identity);
        //mineStake.transform.position = gameObject.transform.position;

        LinealProjectile projectile = mineStake.GetComponent <LinealProjectile>();

        projectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
        projectile.Damage          = _bulletDamage;
        projectile.setRotation(direction);
        projectile.Velocity = direction;
    }
Beispiel #3
0
    private void shotProjectileToTarget()
    {
        Vector2 direction = _target.transform.position - transform.position;

        direction.Normalize();

        GameObject mineStake = Instantiate(_projectile);

        mineStake.transform.position = gameObject.transform.position;

        LinealProjectile projectile = mineStake.GetComponent <LinealProjectile>();

        projectile._projetileOwner = Projectile.ProjectileOwner.ENEMY;
        projectile.Damage          = _damage;
        projectile.setRotation(direction);
        projectile.Velocity = direction;
    }
Beispiel #4
0
    public override void createdBullet(Vector2 direction)
    {
        GameObject bullet = Instantiate(_projectile);

        bullet.transform.position = gameObject.transform.position;

        //rotation
        LinealProjectile projectile = bullet.GetComponent <LinealProjectile>();

        if (projectile != null)
        {
            projectile._projetileOwner = Projectile.ProjectileOwner.ENEMY;
            projectile.Damage          = _damage;
            projectile.setRotation(direction);
            projectile.Velocity = direction;
        }
    }
Beispiel #5
0
    public void shootStake()
    {
        GameObject mineStake   = Instantiate(stakePrefab);
        GameObject secondStake = Instantiate(stakePrefab);
        GameObject thirdStake  = Instantiate(stakePrefab);

        mineStake.GetComponent <StakeControl>().setStake(bulletDamage);
        mineStake.transform.position = gameObject.transform.position;
        LinealProjectile projectile = mineStake.GetComponent <LinealProjectile>();

        projectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
        projectile.setRotation(GetComponentInParent <PlayerAiming>().AimDirection.normalized);
        projectile.Velocity = GetComponentInParent <PlayerAiming>().AimDirection.normalized;

        secondStake.GetComponent <StakeControl>().setStake(bulletDamage);
        secondStake.transform.position = gameObject.transform.position;
        LinealProjectile secondProjectile = secondStake.GetComponent <LinealProjectile>();

        secondProjectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
        float theRotation = Mathf.Atan2(GetComponentInParent <PlayerAiming>().AimDirection.y, GetComponentInParent <PlayerAiming>().AimDirection.x) * Mathf.Rad2Deg;

        theRotation += 20;
        Vector2 newDirectionPositive = new Vector2(Mathf.Cos(theRotation * Mathf.Deg2Rad), Mathf.Sin(theRotation * Mathf.Deg2Rad));

        secondProjectile.setRotation(newDirectionPositive.normalized);
        secondProjectile.Velocity = newDirectionPositive.normalized;


        thirdStake.GetComponent <StakeControl>().setStake(bulletDamage);
        thirdStake.transform.position = gameObject.transform.position;
        LinealProjectile thirdProjectile = thirdStake.GetComponent <LinealProjectile>();

        thirdProjectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
        float the2Rotation = Mathf.Atan2(GetComponentInParent <PlayerAiming>().AimDirection.y, GetComponentInParent <PlayerAiming>().AimDirection.x) * Mathf.Rad2Deg;

        the2Rotation -= 20;
        Vector2 newDirectionNegative = new Vector2(Mathf.Cos(the2Rotation * Mathf.Deg2Rad), Mathf.Sin(the2Rotation * Mathf.Deg2Rad));

        thirdProjectile.setRotation(newDirectionNegative.normalized);
        thirdProjectile.Velocity = newDirectionNegative.normalized;



        StartCoroutine(fire(_fireRate));
    }
Beispiel #6
0
    public void shotStake()
    {
        if (canShoot)
        {
            if (CoolDownTracker <= 0)
            {
                CoolDownTracker = _coolDown;

                GameObject mineStake = Instantiate(_stakePrefab);
                mineStake.GetComponent <StakeControl>().setStake(_damage);
                mineStake.transform.position = gameObject.transform.position;
                LinealProjectile projectile = mineStake.GetComponent <LinealProjectile>();
                projectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
                projectile.setRotation(_aiming.AimDirection.normalized);
                projectile.Velocity = _aiming.AimDirection.normalized;
            }
        }
    }
Beispiel #7
0
    public void shootPosionDart()
    {
        if (canShoot)
        {
            if (CoolDownTracker <= 0)
            {
                CoolDownTracker = _coolDown;

                GameObject poisonDart = Instantiate(_poisonDartPrefab);
                poisonDart.GetComponent <PoisonDartController>().setDart(_damagePerTick);
                poisonDart.transform.position = gameObject.transform.position;
                LinealProjectile projectile = poisonDart.GetComponent <LinealProjectile>();
                projectile._projetileOwner = Projectile.ProjectileOwner.PLAYER;
                projectile.setRotation(_aiming.AimDirection.normalized);
                projectile.Velocity = _aiming.AimDirection.normalized;
            }
        }
    }
Beispiel #8
0
    private void shootBullet()
    {
        if (gameObject.active)
        {
            GameObject bullet = Instantiate(_bulletPrefab);
            bullet.transform.position = gameObject.transform.position;

            //rotation
            LinealProjectile projectile = bullet.GetComponent <LinealProjectile>();
            if (projectile != null)
            {
                projectile._projetileOwner = Projectile.ProjectileOwner.ENEMY;
                projectile.Damage          = _damage;
                projectile.setRotation(direction);
                projectile.Velocity = direction;
            }

            Invoke("shootBullet", fireRate);
        }
    }