public override void processPrimaryHit(Item item, GameObject hit, Vector3 hitPoint, Vector3 direction) { IgniteEffect ignite = hit.AddComponent <IgniteEffect>();//TODO ignite object(applies continuous damage) if in fuel state and no damage if in wet state ignite.startEffect(secondaryOnHitEffect, baseDamage, damagePerSecond, lifeTime); //playPrimaryOnHitEffect(hit, hitPoint); base.processPrimaryHit(item, hit, hitPoint, direction); }
protected void combust() { if (combusted) { return; } combusted = true; GetComponent <IgniteEffect>()?.endEffect(); IgniteEffect newEffect = gameObject.AddComponent <IgniteEffect>(); newEffect.startEffect(flames, 10, damagePerSecond, burnTime); Collider[] objects = Physics.OverlapSphere(transform.position, 7.5f, LayerMask.GetMask("Destructable")); foreach (var colliderObject in objects) { CombustioEffect combustio = colliderObject.GetComponent <CombustioEffect>(); if (combustio != null) { colliderObject.GetComponent <CombustioEffect>().combust(); } } }