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); }
private void Start() { _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += DestroySpaceship; _shipAnimator = GetComponent <Animator>(); }
private float _attackVariable_2; // Used for multiple things such as charge and rotation etc... public override void _Ready() { _armStatus = new ArmStatus() { firstArmAlive = true, secondArmAlive = true, firstArmHealth = 1, secondArmHealth = 1 }; _firstArmHealthSetter = GetNode <HealthSetter>(firstArmNodePath); _secondArmHealthSetter = GetNode <HealthSetter>(secondArmNodePath); _firstArmSingleController = GetNode <BossSingleArmController>(firstArmSingleControllerNodePath); _secondArmSingleController = GetNode <BossSingleArmController>(secondArmSingleControllerNodePath); _firstArmAttackPosition = GetNode <Node2D>(firstArmAttackNodePath); _secondArmAttackPosition = GetNode <Node2D>(secondArmAttackNodePath); _dualArmAttackPosition = GetNode <Node2D>(dualArmAttackNodePath); _bulletHolder = GetNode <Node2D>(bulletHolderNodePath); _firstArmHealthSetter.healthChanged += HandleFirstArmHealthChange; _secondArmHealthSetter.healthChanged += HandleSecondArmHealthChange; // This is done as all child nodes fire their ready before the parent HandleFirstArmHealthChange(_firstArmHealthSetter.GetCurrentHealth(), _firstArmHealthSetter.GetMaxHealth()); HandleSecondArmHealthChange(_secondArmHealthSetter.GetCurrentHealth(), _secondArmHealthSetter.GetMaxHealth()); }
public override void ActivatePowerUp(Transform parent) { base.PowerUpActive = true; int asteroidChildCount = _asteroidHolder.childCount; if (asteroidChildCount > 0) { int randomIndex = Random.Range(0, 1000) % asteroidChildCount; HealthSetter asteroidHealthSetter = _asteroidHolder.GetChild(randomIndex).GetComponent <HealthSetter>(); asteroidHealthSetter.ReduceHealth(int.MaxValue); return; } int spaceshipChildCount = _spaceshipHolder.childCount; if (spaceshipChildCount > 0) { int randomIndex = Random.Range(0, 1000) % spaceshipChildCount; HealthSetter spaceshipHealthSetter = _spaceshipHolder.GetChild(randomIndex).GetComponent <HealthSetter>(); spaceshipHealthSetter.ReduceHealth(int.MaxValue); } base.DeactivatePowerUp(); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _playerAnimator = GetComponent <Animator>(); _deactivatePlayer = GetComponent <DeactivatePlayerControls>(); _deathAudio = GetComponent <AudioSource>(); _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += AnimatePlayerDead; }
private void Start() { _healthSetter = GetComponent <HealthSetter>(); _maxHealth = _healthSetter.maxHealthAmount; _smokeInstantiated = false; _oneThirdHealth = _maxHealth * 0.75f; DisplayDamageEffect(); _healthSetter.healthChanged += DisplayDamageEffect; }
private void Start() { if (!isServer) { return; } _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += DestroyAsteroid; _asteroidsHolder = GameObject.FindGameObjectWithTag(TagManager.AsteroidsHolder)?.transform; }
private void Start() { if (!isServer) { return; } _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += CheckAndSpawnPowerUp; _powerUpsHolder = GameObject.FindGameObjectWithTag(TagManager.PowerUpsHolder)?.transform; }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _droneAnimator = GetComponent <Animator>(); _droneAgent = GetComponent <NavMeshAgent>(); _droneRB = GetComponent <Rigidbody>(); _droneController = GetComponent <DroneController>(); _smokeParticles = new List <ParticleSystem>(); _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += DroneDead; }
public override void _Ready() { _bodyStatus = new BodyStatus() { bodyDestroyed = false, bodyHealth = 1 }; _bossBodyHealthSetter = GetNode <HealthSetter>(bossBodyNodePath); _bossBodyHealthSetter.healthChanged += HandleBodyHealthChanged; HandleBodyHealthChanged(_bossBodyHealthSetter.GetCurrentHealth(), _bossBodyHealthSetter.GetMaxHealth()); }
public override void _Ready() { Connect("body_entered", this, nameof(HandlePlayerEntered)); Connect("body_exited", this, nameof(HandlePlayerExited)); _playerHealthSetter = GetNode <HealthSetter>(playerHealthSetterNodePath); _playerHealthSetter.zeroHealth += HandlePlayerHealthZero; _currentRevealCount = maxRevealCount; _portalCountDisplayLabel = GetNode <Label>(portalCountDisplayLabelNodePath); _portalCountDisplayLabel.SetText($"X {_currentRevealCount}"); PlaceAtRandomYPosition(); }
private void DecreaseHealthOnContact(HealthSetter healthSetter, GameObject other) { if (_targetPlayer) { if (!other.CompareTag(TagManager.Player)) { return; } healthSetter.ReduceHealth(_affector.Amount); } else { healthSetter.ReduceHealth(_affector.Amount); } }
private void Start() { _droidAgent = GetComponent <NavMeshAgent>(); _droidLaze = GetComponent <DroidLaze>(); _droidAttack = GetComponent <DroidAttack>(); _droidHealthSetter = GetComponent <HealthSetter>(); _droidHealthSetter.healthZero += NotifyKilled; _player = GameObject.FindGameObjectWithTag(TagManager.Player)?.transform; _distractorHolder = GameObject.FindGameObjectWithTag(TagManager.DistractorHolder)?.transform; _meshCenter = transform.position; _terrainMeshVertices = transform.parent.GetComponent <MeshFilter>().mesh.vertices; _droidAttackTarget = DroidAttackTarget.None; SetAgentRandomPatrolPoint(); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _creatureAgent = GetComponent <NavMeshAgent>(); _creatureAttack = GetComponent <CreatureAttack>(); _creatureLaze = GetComponent <CreatureLaze>(); _healthSetter = GetComponent <HealthSetter>(); _healthSetter.damageTaken += SetPlayerHostile; _player = GameObject.FindGameObjectWithTag(TagManager.Player)?.transform; NavMeshTriangulation triangulation = NavMesh.CalculateTriangulation(); _vertices = triangulation.vertices; _creatureState = CreatureState.Idle; SelectRandomPatrolPoint(); }
private void OnTriggerEnter2D(Collider2D other) { HealthSetter healthSetter = other.GetComponent <HealthSetter>(); if (!healthSetter) { return; } if (_increaseHealth) { IncreaseHealthOnContact(healthSetter, other.gameObject); } else { DecreaseHealthOnContact(healthSetter, other.gameObject); } }
public override void _Ready() { _playerShooting = GetNode <PlayerShooting>(playerShootingNodePath); _playerShieldController = GetNode <PlayerShieldController>(playerShieldControllerNodePath); _playerHealthSetter = GetNode <HealthSetter>(playerHealthSetterNodePath); _playerHeartScaleBlinker = GetNode <ScaleBlinker>(playerHeartScaleBlinkerNodePath); _movement = new Vector2(); _currentMovementSpeed = movementSpeed; _targetScale = Vector2.One * defaultScaleAmount; _lerpPosition = new Vector2(); SetPlayerState(PlayerState.PlayerInControlMovement); _playerHealthSetter.healthChanged += HandleHeathChange; _playerHealthSetter.zeroHealth += HandlePlayerHealthZero; _playerShooting.bulletShot += HandleBulletShot; PlayerModifierSoulsManager.instance.handleStatusChanged += HandleSoulsChange; }
public override void _Ready() { _rotationNode = GetNode <Node2D>(rotationNodePath); _enemyHealthSetter = GetNode <HealthSetter>(enemyHealthSetterNodePath); _enemyHealthSetter.zeroHealth += HandleHealthZero; _launchPoints = new List <Node2D>(); foreach (NodePath launchPoint in launchPointsPath) { _launchPoints.Add(GetNode <Node2D>(launchPoint)); } _startPosition = GetGlobalPosition(); _enemyTimer = 0; _playerTargetSqDst = playerTargetDistance * playerTargetDistance; _playerAttackSqDst = playerAttackDistance * playerAttackDistance; _maxPlayerFollowSqDst = maxPlayerFollowDistance * maxPlayerFollowDistance; SetEnemyState(EnemyState.Idling); }
private void OnCollisionEnter2D(Collision2D other) { if (_objectRb.velocity.sqrMagnitude < _minAffectMagnitude) { return; } if (_affectOnlyPlayer) { if (other.gameObject.CompareTag(TagManager.Player)) { HealthSetter playerHealthSetter = other.gameObject.GetComponent <HealthSetter>(); playerHealthSetter.ReduceHealth(_damageAmount); } } else { HealthSetter healthSetter = other.gameObject.GetComponent <HealthSetter>(); if (healthSetter != null) { healthSetter.ReduceHealth(_damageAmount); } } }
public override void _Ready() { GD.Randomize(); if (instance == null) { instance = this; } _playerController = GetNode <PlayerController>(playerControllerNodePath); _playerShooting = GetNode <PlayerShooting>(playerShooterNodePath); _playerHealthSetter = GetNode <HealthSetter>(playerHealthSetterNodePath); _pauseResumeController = GetNode <PauseAndResume>(pauseResumeControllerNodePath); Fader.FaderReady faderActivate = null; faderActivate = () => { Fader.instance.StartFading(false, new Color(1, 1, 1)); Fader.faderReady -= faderActivate; }; Fader.faderReady += faderActivate; }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _healthSetter = GetComponent <HealthSetter>(); _healthSetter.healthZero += OnEnemyDead; }
public override void _Ready() => _healthSetter = GetNode <HealthSetter>(healthSetterNodePath);
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _isShipNearby = false; _healthSetter = GetComponentInParent <HealthSetter>(); }
private void Start() => _playerHealth = GameObject.FindGameObjectWithTag(TagManager.Player)?.GetComponent <HealthSetter>();