Skip to content

OnAIBrainStateSwitch

Usage

  • Return a non-null value or bool to override default behavior

Example Autogenerated

csharp
private void OnAIBrainStateSwitch( BaseAIBrain instance, BasicAIState CurrentState, BasicAIState newState )
{
    Puts( "OnAIBrainStateSwitch works!" );
}

Location

  • BaseAIBrain::SwitchToState(BaseAIBrain/BasicAIState newState, int stateContainerID)
csharp
//---
		}
		if (this.CurrentState == newState && !this.UseAIDesign)
		{
			return false;
		}
		object returnvar = Interface.CallHook("OnAIBrainStateSwitch", this, this.CurrentState, newState);
		if (returnvar != null)
		{
			return returnvar is bool && (bool)returnvar;
		}
		this.CurrentState.StateLeave(this, this.GetBaseEntity());
//---

Released under the MIT License.