/// <summary> /// Init this instance, used for projectiles or hit boxes which are not children of a character. /// </summary> public virtual void Init(DamageInfo info, IMob character, Projectile projectile, bool destroyOnEnemyHit, bool destroyOnSceneryHit) { this.character = character; if (character == null) { Debug.LogError ("A ProjectileHitBox (CharacterHitBox) must have a character"); } myCollider = GetComponent<Collider2D>(); if (myCollider == null) { Debug.LogError("A ProjectileHitBox (CharacterHitBox) must be on the same GameObject as a Collider2D"); } myCollider.enabled = true; this.damageInfo = info; this.projectile = projectile; this.destroyOnSceneryHit = destroyOnSceneryHit; this.destroyOnEnemyHit = destroyOnEnemyHit; }