public virtual void Initialize(Effect parentEffect, LayerMask mask, float life = 0f, float damage = 0f) { this.parentEffect = parentEffect; LayerMask = mask; stats = new StatCollection(); stats.Initialize(statTemplate); ParentFacing = parentEffect.Source.Facing; if (this.parentEffect is EffectAttack) { EffectAttack attackEffect = this.parentEffect as EffectAttack; penetrating = attackEffect.penetrate; numPen = attackEffect.numPenetrations; impactEffect = attackEffect.impactEffectName; } this.life = life + stats.GetStatModifiedValue(Constants.BaseStatType.Lifetime); this.damage = damage + stats.GetStatModifiedValue(Constants.BaseStatType.BaseDamage); if (this.life > 0f) { Invoke("CleanUp", this.life); } }
protected void SetUpStats() { ProjectileStats = new StatCollection(gameObject, OnStatChanged, statTemplate); maxSpeed = ProjectileStats.GetStatModifiedValue(BaseStat.StatType.MoveSpeed); float life = ProjectileStats.GetStatModifiedValue(BaseStat.StatType.Lifetime); if (life > 0) { Invoke("CleanUp", life); } }
private void OnStatChanged(BaseStat.StatType type, GameObject source) { if (type == BaseStat.StatType.CoolDown) { coolDownTimer.SetNewDuration(Stats.GetStatModifiedValue(BaseStat.StatType.CoolDown)); } }