Example #1
0
        private void LaunchRandomArmAttack()
        {
            int randomArmIndex = (int)(GD.Randi() % _bossArmControllers.Count);

            randomArmIndex = Mathf.Abs(randomArmIndex);

            while (true)
            {
                BossArmController           bossArmController = _bossArmControllers[randomArmIndex];
                BossArmController.ArmStatus armStatus         = bossArmController.GetArmStatus();
                if (armStatus.firstArmAlive && armStatus.secondArmAlive)
                {
                    bossArmController.LaunchDualArmAttack(_timeBetweenEachAttack);
                    break;
                }
                else
                {
                    randomArmIndex = (int)(GD.Randi() % _bossArmControllers.Count);
                    randomArmIndex = Mathf.Abs(randomArmIndex);
                }
            }

            if (_previousArmIndex != -1)
            {
                _bossArmControllers[_previousArmIndex].ClearDualArmAttack();
            }

            _previousArmIndex = randomArmIndex;
        }
Example #2
0
        public override void _Ready()
        {
            _bodyController = GetNode <BossBodyController>(bodyNodePath);
            _bodyController.bodyStatusChanged += HandleBodyStatusChanged;

            _leftArmController   = GetNode <BossArmController>(leftArmNodePath);
            _rightArmController  = GetNode <BossArmController>(rightArmNodePath);
            _topArmController    = GetNode <BossArmController>(topArmNodePath);
            _bottomArmController = GetNode <BossArmController>(bottomArmNodePath);

            _bossTotalHealthSetter = GetNode <HealthSetter>(bossTotalHealthSetter);

            _leftArmController.armStatusChanged   += HandleArmStatusChanged;
            _rightArmController.armStatusChanged  += HandleArmStatusChanged;
            _topArmController.armStatusChanged    += HandleArmStatusChanged;
            _bottomArmController.armStatusChanged += HandleArmStatusChanged;

            _frenzySpinningShotAttack = GetNode <FrenzySpinningShot>(frenzyAttackNodePath);
            _singleArmAttack          = GetNode <SingleArmAttack>(singleArmAttackNodePath);
            _dualArmAttack            = GetNode <DoubleArmAttack>(dualArmAttackNodePath);
            _bossAttacks = new List <BossBaseAttack>();
            for (int i = 0; i < bossAttacks.Count; i++)
            {
                _bossAttacks.Add(GetNode <BossBaseAttack>(bossAttacks[i]));
            }

            GD.Print("Setting Boss Total Health");
            SetBossMaxHealth();
            ComputeTotalBossHealth();

            _bossHealthBodyStatus = new BossHealthBodyStatus();
            SetBossHealthBodyStatus();

            SetBossState(BossState.Idle);
        }