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); } }
public void Initialize() { SessionID = IDFactory.GenerateEntityID(); stats = new StatCollection(); stats.Initialize(statTemplate); SpriteRenderer = GetComponentInChildren <SpriteRenderer>(); MyAnimator = GetComponentInChildren <Animator>(); AbilityManager = GetComponent <AbilityManager>(); inventory = GetComponent <Inventory>(); movement = GetComponent <EntityMovement>(); healthDeathManager = GetComponent <HealthDeathManager>(); if (inventory != null) { inventory.Initialize(this); } if (AbilityManager != null) { AbilityManager.Initialize(this); } if (movement != null) { movement.Initialize(); } if (healthDeathManager != null) { healthDeathManager.Initialize(this); } AIBrain testBrain = GetComponent <AIBrain>(); if (testBrain != null) { testBrain.Initialize(); } GameManager.RegisterEntity(this); }