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);
        }
    }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
 protected virtual void Start()
 {
     health = GetComponent <TimedHealth>();
     health.OnDeathEvent += OnDeathEvent;
 }
Exemplo n.º 4
0
 private void Start()
 {
     health = GetComponent <TimedHealth>();
     health.OnDeathEvent += ScoreOnDeath;
 }
Exemplo n.º 5
0
    protected override void Apply(Transform Transform)
    {
        TimedHealth health = Transform.GetComponent <TimedHealth>();

        health.SetHealthDelta(health.CurrentMaxHealth * percentageToFill);
    }