private bool OnFieldEnter(EvtFieldEnter evt) { if ((this._warningFieldActor == null) || (this._warningFieldActor.runtimeID != evt.targetID)) { return(false); } if (this._warningFieldState != WarningFieldState.Outside) { return(false); } this._owner.monster.SetUseAIController(true); this._warningFieldActor.triggerField.transform.localScale = (Vector3)(Vector3.one * this._escapeRadius); this._warningFieldState = WarningFieldState.Inside; return(true); }
public void InitWarningField(float warningRadius, float escapeRadius) { if ((this._warningFieldState == WarningFieldState.None) && ((warningRadius > 0f) && (escapeRadius >= warningRadius))) { this._warningRadius = warningRadius; this._escapeRadius = escapeRadius; this._warningFieldActor = Singleton <DynamicObjectManager> .Instance.CreateAbilityTriggerField(this._owner.monster.transform.position, this._owner.monster.transform.forward, this._owner, this._warningRadius, MixinTargetting.Enemy, Singleton <DynamicObjectManager> .Instance.GetNextNonSyncedDynamicObjectRuntimeID(), true); this._warningFieldState = WarningFieldState.Outside; this._owner.monster.OrderMove = false; this._owner.monster.ClearHitTrigger(); this._owner.monster.ClearAttackTriggers(); this._owner.monster.SetUseAIController(false); Singleton <EventManager> .Instance.RegisterEventListener <EvtFieldEnter>(this._owner.runtimeID); Singleton <EventManager> .Instance.RegisterEventListener <EvtFieldExit>(this._owner.runtimeID); } }
private bool OnFieldExit(EvtFieldExit evt) { if ((this._warningFieldActor == null) || (this._warningFieldActor.runtimeID != evt.targetID)) { return(false); } if (this._warningFieldState != WarningFieldState.Inside) { return(false); } this._owner.monster.OrderMove = false; this._owner.monster.ClearHitTrigger(); this._owner.monster.ClearAttackTriggers(); this._owner.monster.SetUseAIController(false); this._warningFieldActor.triggerField.transform.localScale = (Vector3)(Vector3.one * this._warningRadius); this._warningFieldState = WarningFieldState.Outside; return(true); }
public override void OnRemoved() { if (this._warningFieldState > WarningFieldState.None) { Singleton <EventManager> .Instance.RemoveEventListener <EvtFieldEnter>(this._owner.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtFieldExit>(this._owner.runtimeID); this._warningFieldActor.Kill(); this._warningFieldState = WarningFieldState.None; } if (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Single) { AvatarManager instance = Singleton <AvatarManager> .Instance; instance.onLocalAvatarChanged = (Action <BaseMonoAvatar, BaseMonoAvatar>)Delegate.Remove(instance.onLocalAvatarChanged, new Action <BaseMonoAvatar, BaseMonoAvatar>(this.OnLocalAvatarChanged)); } this._owner.onAbilityStateAdd = (Action <AbilityState, bool>)Delegate.Remove(this._owner.onAbilityStateAdd, new Action <AbilityState, bool>(this.OnAbilityStateAdd)); this._owner.onAbilityStateRemove = (Action <AbilityState>)Delegate.Remove(this._owner.onAbilityStateRemove, new Action <AbilityState>(this.OnAbilityStateRemove)); this._owner.monster.onHitStateChanged = (Action <BaseMonoMonster, bool, bool>)Delegate.Remove(this._owner.monster.onHitStateChanged, new Action <BaseMonoMonster, bool, bool>(this.OnHitStateChanged)); }