Beispiel #1
0
        private void LaunchChargedAttack()
        {
            if (_chargedBullet == null)
            {
                return;
            }

            Vector2 launchPosition = _dualArmAttackPosition.GetGlobalPosition();
            float   launchAngle    = -Mathf.Rad2Deg(Mathf.Atan2(
                                                        launchPosition.x - PlayerVariables.LastPlayerPosition.x,
                                                        launchPosition.y - PlayerVariables.LastPlayerPosition.y
                                                        )) - 90;

            float   xVelocity      = Mathf.Cos(Mathf.Deg2Rad(launchAngle));
            float   yVelocity      = Mathf.Sin(Mathf.Deg2Rad(launchAngle));
            Vector2 launchVelocity = new Vector2(xVelocity, yVelocity);

            _dualArmAttackPosition.RemoveChild(_chargedBullet);
            _bulletHolder.AddChild(_chargedBullet);

            _chargedBullet.SetMode(RigidBody2D.ModeEnum.Rigid);
            _chargedBullet.LaunchBullet(launchVelocity.Normalized());
            _chargedBullet.SetAsDynamicBullet();
            _chargedBullet.SetGlobalPosition(launchPosition);
            _chargedBullet.SetGlobalScale(Vector2.One * _attackVariable_1);

            _chargedEffectDestroy.DestroyNode();

            _attackVariable_1     = 0;
            _chargedEffectDestroy = null;
            _chargedBullet        = null;
        }
Beispiel #2
0
        private void LaunchBullet()
        {
            BossBullet bossBulletInstance = (BossBullet)bulletPrefab.Instance();

            _bulletHolder.AddChild(bossBulletInstance);

            bossBulletInstance.SetGlobalPosition(_bossAttackPoint.GetGlobalPosition());

            float   xVelocity    = Mathf.Cos(Mathf.Deg2Rad(_currentAngle));
            float   yVelocity    = Mathf.Sin(Mathf.Deg2Rad(_currentAngle));
            Vector2 launchVector = new Vector2(xVelocity, yVelocity);

            bossBulletInstance.LaunchBullet(launchVector.Normalized());
        }
Beispiel #3
0
        private void LaunchSingleArmAttack(Vector2 attackPosition)
        {
            BossBullet bulletInstance = (BossBullet)singleArmBulletPrefab.Instance();

            _bulletHolder.AddChild(bulletInstance);

            float   xVelocity      = Mathf.Cos(Mathf.Deg2Rad(_attackVariable_1));
            float   yVelocity      = Mathf.Sin(Mathf.Deg2Rad(_attackVariable_1));
            Vector2 launchVelocity = new Vector2(xVelocity, yVelocity);

            bulletInstance.SetGlobalPosition(attackPosition);
            bulletInstance.LaunchBullet(launchVelocity);

            _attackVariable_1 += singeArmAttackAngleDiff;
            _attackVariable_1  = ExtensionFunctions.To360Angle(_attackVariable_1);
        }
Beispiel #4
0
        private void LaunchBullets()
        {
            _isOffsetUsed = !_isOffsetUsed;

            for (int i = 0; i < bulletsInEachRow; i++)
            {
                BossBullet bossBulletInstance = (BossBullet)bulletPrefab.Instance();
                _bulletHolder.AddChild(bossBulletInstance);

                float   indexRatio    = (float)i / bulletsInEachRow;
                Vector2 finalPosition = _spawnLeftMostPoint.GetGlobalPosition().LinearInterpolate(_spawnRightMostPoint.GetGlobalPosition(), indexRatio);
                if (_isOffsetUsed)
                {
                    finalPosition.x += bulletGapOffset;
                }

                bossBulletInstance.SetGlobalPosition(finalPosition);
                bossBulletInstance.LaunchBullet(bulletDefaultVelocity.Normalized());
            }
        }
Beispiel #5
0
        private void LaunchSprayShot()
        {
            float angleDiff         = 360.0f / totalSprayShotBullets;
            float currentSprayAngle = _currentRotationAmount;

            for (int i = 0; i < totalSprayShotBullets; i++)
            {
                BossBullet bossBulletInstance = (BossBullet)bulletPrefab.Instance();
                _bulletHolder.AddChild(bossBulletInstance);

                bossBulletInstance.SetGlobalRotationDegrees(currentSprayAngle + rotationOffset);
                bossBulletInstance.SetGlobalPosition(_bossAttackPoint.GetGlobalPosition());

                float   xVelocity    = Mathf.Cos(Mathf.Deg2Rad(currentSprayAngle));
                float   yVelocity    = Mathf.Sin(Mathf.Deg2Rad(currentSprayAngle));
                Vector2 launchVector = new Vector2(xVelocity, yVelocity);
                bossBulletInstance.LaunchBullet(launchVector);

                currentSprayAngle += angleDiff;
            }
        }
Beispiel #6
0
        private void LaunchBullet()
        {
            float currentShotAngle = _currentAngle;
            float angleDiff        = 360.0f / eachShotBulletCount;

            for (int i = 0; i < eachShotBulletCount; i++)
            {
                BossBullet bossBulletInstance = (BossBullet)bulletPrefab.Instance();
                _bulletHolder.AddChild(bossBulletInstance);

                bossBulletInstance.SetGlobalPosition(_bossAttackPoint.GetGlobalPosition());

                float   xVelocity    = Mathf.Cos(Mathf.Deg2Rad(currentShotAngle));
                float   yVelocity    = Mathf.Sin(Mathf.Deg2Rad(currentShotAngle));
                Vector2 launchVector = new Vector2(xVelocity, yVelocity);
                bossBulletInstance.LaunchBullet(launchVector.Normalized());

                currentShotAngle += angleDiff;
                currentShotAngle  = ExtensionFunctions.To360Angle(currentShotAngle);
            }
        }