protected override void Apply(Transform other) { if (GameTime.Instance.GameSpeed <= 0) { return; } Transform target = (applyOnOther? other : TargetTransform); TimedHealth health = target.GetComponent <TimedHealth>(); if (health == null) { ApplyDamageOnCollision collision = target.GetComponent <ApplyDamageOnCollision>(); if (collision == null) { return; } health = collision.TargetTransform.GetComponent <TimedHealth>(); } if (health != null) { health.SetHealthDelta(-damage); } }
void Start() { gameTime = GameTime.Instance; timeBoundTransform = GetComponent <GameTimeBoundTransform>(); health = GetComponent <TimedHealth>(); health.OnDeathEvent += OnDeath; isTimeVoyaging = false; timeBoundTransform.IgnoreGameSpeed = false; timeVoyageRatio.Value = 0; body = GetComponent <Rigidbody2D>(); timeHandler = gameTime; shotElapsed = 0.0f; defaultMask = LayerMask.LayerToName(gameObject.layer); playerStats.OnChangeEvent += OnStatsChanged; hasStarted = false; }
protected virtual void Start() { health = GetComponent <TimedHealth>(); health.OnDeathEvent += OnDeathEvent; }
private void Start() { health = GetComponent <TimedHealth>(); health.OnDeathEvent += ScoreOnDeath; }
protected override void Apply(Transform Transform) { TimedHealth health = Transform.GetComponent <TimedHealth>(); health.SetHealthDelta(health.CurrentMaxHealth * percentageToFill); }