protected override bool Reason(AIBehaviors fsm) { return(true); }
void HandleTargetReached(AIBehaviors fsm) { targetPosition = GetTargetPoint(fsm); }
protected override void StateEnded(AIBehaviors fsm) { }
protected override void DrawStateInspectorEditor(SerializedObject stateObject, AIBehaviors fsm) { SerializedProperty property; GUILayout.Label("Wander Properties:", EditorStyles.boldLabel); GUILayout.BeginVertical(GUI.skin.box); // Properties property = stateObject.FindProperty("floorLayers"); EditorGUILayout.PropertyField(property); property = stateObject.FindProperty("stayCloseToPoint"); EditorGUILayout.PropertyField(property); if (property.boolValue) { property = stateObject.FindProperty("anchorPoint"); EditorGUILayout.PropertyField(property); property = stateObject.FindProperty("maxDistanceFromAnchor"); EditorGUILayout.PropertyField(property); } GUILayout.EndVertical(); stateObject.ApplyModifiedProperties(); if (Application.isPlaying) { GUILayout.Label("Debug:", EditorStyles.boldLabel); GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label("Distance to target: " + (transform.position - targetPosition).magnitude.ToString(), EditorStyles.boldLabel); GUILayout.EndVertical(); } }
protected override void Init(AIBehaviors fsm) { sqrDistanceToTargetThreshold = GetSquareDistanceThreshold(); fsm.PlayAudio(); }
protected override void DrawStateInspectorEditor(SerializedObject stateObject, AIBehaviors stateMachine) { SerializedProperty property; GUILayout.Label("Seek Properties:", EditorStyles.boldLabel); GUILayout.BeginVertical(GUI.skin.box); property = stateObject.FindProperty("specifySeekTarget"); EditorGUILayout.PropertyField(property); if (property.boolValue) { property = stateObject.FindProperty("seekTarget"); EditorGUILayout.PropertyField(property); } else { GUILayout.Label("Seek items with tag:"); property = stateObject.FindProperty("seekItemsWithTag"); property.stringValue = EditorGUILayout.TagField(property.stringValue); } EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); { GUILayout.Label("Seek Target Reached Transition:"); property = stateObject.FindProperty("seekTargetReachedState"); property.objectReferenceValue = AIBehaviorsStatePopups.DrawEnabledStatePopup(stateMachine, property.objectReferenceValue as BaseState); } GUILayout.EndHorizontal(); property = stateObject.FindProperty("distanceToTargetThreshold"); float prevValue = property.floatValue; EditorGUILayout.PropertyField(property); if (property.floatValue <= 0.0f) { property.floatValue = prevValue; } property = stateObject.FindProperty("destroyTargetWhenReached"); EditorGUILayout.PropertyField(property); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); { GUILayout.Label("No Seek Target Transition:"); property = stateObject.FindProperty("noSeekTargetFoundState"); property.objectReferenceValue = AIBehaviorsStatePopups.DrawEnabledStatePopup(stateMachine, property.objectReferenceValue as BaseState); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); stateObject.ApplyModifiedProperties(); }
protected override void Init(AIBehaviors fsm) { transformPreviousPositions = new Dictionary <Transform, Vector3>(); previousCheckTime = Time.time; }