public override void SpawnBehavior(float timeSpentInCurrentState) { if (!_hitbox.activeSelf && timeSpentInCurrentState <= Time.fixedDeltaTime) { _hitbox.SetActive(true); _hurtbox.SetActive(true); } if (timeSpentInCurrentState >= _spawnDuration) { OnSpawnComplete.Invoke(); } if (timeSpentInCurrentState < Time.fixedDeltaTime && !initialPosition.Equals(default(Vector3))) { //spawnforce is calculated by the tower that instantiates the Orbiter float multiplier = _maxVelocity * _rigidbody.mass / Time.fixedDeltaTime; Vector3 spawnForce = initialDirection; spawnForce.Scale(new Vector3(multiplier, multiplier, multiplier)); _rigidbody.AddForce(spawnForce); } else { CircleAroundStage(); } }
public override void SpawnBehavior(float timeSpentInCurrentState) { //activate the hitbox after 1 second has passed so that the player wont get killed immediately if a tower spawns beneath if (!_hitbox.activeSelf && timeSpentInCurrentState >= 1) { _hitbox.SetActive(true); } if (timeSpentInCurrentState >= _spawnDuration) { OnSpawnComplete.Invoke(); } MoveTower(); }
public override void SpawnBehavior(float timeSpentInCurrentState) { //activate the hitbox after 2 seconds has passed so that the player wont get killed immediately if a golem spawns beneath them if (!_hitbox.activeSelf && timeSpentInCurrentState >= 2) { _hitbox.SetActive(true); _headHitbox.SetActive(true); } if (timeSpentInCurrentState >= _spawnDuration) { _stepEndTime = Time.time; _lastShotTime = Time.time; _aimLaser.gameObject.SetActive(true); OnSpawnComplete.Invoke(); _hurtbox.SetActive(true); } }
/// <summary> /// Triggers the on spawn complete event /// </summary> public virtual void TriggerOnSpawnComplete() { OnSpawnComplete?.Invoke(); }