private void OnDamage(DamageInfo info, DamageablePart damageablePart) { Stimulation stim = null; if (info.sender != null) { stim = info.sender.GetComponentInChildren <Stimulation>(); } if (owner != null && stim != null && (owner.CurrentInterest == null || owner.CurrentInterest.stimulation == null || owner.CurrentInterest.stimulation != stim)) { AI_Interest interest = GetInterestIfExits(stim); if (interest != null) { interest.lastKnowPosition = info.sender.transform.position; } else { interest = new AI_Interest(stim, 0.35f); interest.lastKnowPosition = info.sender.transform.position; interest.inRange = true; interest.isAttackingMe = true; InterestList.Add(interest); } } }
protected override void OnSensorUpdate() { if (owner.CurrentInterest != null) { AI_Interest interest = GetInterestIfExits(owner.CurrentInterest.stimulation); if (interest != null) { InterestList.Remove(owner.CurrentInterest); } } }