/// <summary> /// Detects if fish is no longer close to another light /// </summary> private void OnLightExit(GameObject lightObject) { LightSource lightSource = lightObject.GetComponentInParent <LightSource>(); if (lightSource) { if (lightSource.CompareTag("Fish")) { if (!ignoreFishOfSameType || lightSource.gameObject.layer != gameObject.layer) { // Inform subclasses that the NPC went out of sight NPCOutOfSight(lightSource.transform); string otherID = lightSource.GetComponent <AbstractFish>().GetID(); RemoveAction(otherID); } } else if (lightSource.CompareTag("Player")) { // Player id = -1 RemoveAction("-1"); } } if (lightObject.CompareTag("Flare")) { // Stop reacting to the flare RemoveAction("-2"); } }
private IEnumerator BreakLight(LightSource light) { yield return(WaitFor.Seconds(Random.Range(0f, 1f))); var integrity = light.GetComponent <Integrity>(); integrity.ApplyDamage(light.integrityThreshBar, AttackType.Internal, DamageType.Burn); }