private void Shoot(Vector3 ShootDirection, Vector3 RotateAngle, float Velocity, BaseBullet BulletPrefab)
 {
     currentBullet = SimplePool.Spawn(BulletPrefab, shootTransform.position, Quaternion.identity);
     currentBullet.GetComponent <Rigidbody2D>().velocity = Vector3.Normalize(ShootDirection) * Velocity;
     currentBullet.transform.localEulerAngles            = RotateAngle;
     currentBullet.SetBulletDamage(playerDamage);
 }
 private void Shoot()
 {
     for (int i = 0; i < bulletShootDirection_Parabol.Length; i++)
     {
         currentBullet = SimplePool.Spawn(bulletPrefab_Gravity, transform.position + spawnOffset, Quaternion.identity);
         currentBullet.GetComponent <Rigidbody2D>().velocity = Vector3.Normalize(bulletShootDirection_Parabol[i]) * bulletInitialVelocity;
         currentBullet.transform.localScale       = bulletShootDirection_Parabol[i].x > 0 ? Vector3.one : leftScale;
         currentBullet.transform.localEulerAngles = new Vector3(0, 0, Vector3.SignedAngle(currentBullet.transform.localScale.x == 1 ? Vector3.right : Vector3.left, bulletShootDirection_Parabol[i], Vector3.forward));
         currentBullet.SetBulletDamage(enemyDamage);
     }
 }
Example #3
0
    void AimShoot(float velocity, float speedMoveTween)
    {
        for (int i = 0; i < numberLiner; i++)
        {
            currentBulletAim.transform.position = new Vector3(shootPos.position.x, shootPos.position.y + distance * i, shootPos.position.z);
            Vector3 direction = aimTarget - currentBulletAim.transform.position;
            currentBulletAim.GetComponent <Rigidbody>().velocity = direction.normalized * velocity;
            moveTweenAim = currentBulletAim.transform.DOMove(direction, speedMoveTween).SetEase(Ease.Linear).SetLoops(-1, LoopType.Incremental);


            currentBulletAimQuantity++;
        }
    }
 private void ParabolShoot()
 {
     if (isMovingRightDirection)
     {
         currentBullet = SimplePool.Spawn(bulletPrefab_Gravity, shootTransform.position, Quaternion.identity);
         currentBullet.GetComponent <Rigidbody2D>().velocity = Vector3.Normalize(rightShootDirection_Parabol) * bulletInitialVelocity;
         currentBullet.transform.localScale = Vector3.one;
         //currentBullet.transform.localEulerAngles
     }
     else
     {
         currentBullet = SimplePool.Spawn(bulletPrefab_Gravity, shootTransform.position, Quaternion.identity);
         currentBullet.GetComponent <Rigidbody2D>().velocity = Vector3.Normalize(leftShootDirection_Parabol) * bulletInitialVelocity;
         currentBullet.transform.localScale = leftScale;
     }
     currentBullet.SetBulletDamage(playerDamage);
 }
Example #5
0
 public void SetBulletGravity()
 {
     currentBullet.GetComponent <Rigidbody2D>().gravityScale = _gravityScale;
 }