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 CreateChargedAttack()
        {
            // Charged Bullet
            _chargedBullet = (BossBullet)chargedBulletPrefab.Instance();
            _dualArmAttackPosition.AddChild(_chargedBullet);
            _chargedBullet.SetMode(RigidBody2D.ModeEnum.Kinematic);
            _chargedBullet.SetGlobalPosition(_dualArmAttackPosition.GetGlobalPosition());
            _chargedBullet.SetAsStaticBullet();

            // Charged Bullet Effect
            _chargedEffectDestroy = (DestroyNodeForced)chargingEffectPrefab.Instance();
            _dualArmAttackPosition.AddChild(_chargedEffectDestroy);
        }