Ejemplo n.º 1
0
 protected override bool Reason(AIBehaviors fsm)
 {
     return(true);
 }
Ejemplo n.º 2
0
 void HandleTargetReached(AIBehaviors fsm)
 {
     targetPosition = GetTargetPoint(fsm);
 }
Ejemplo n.º 3
0
 protected override void StateEnded(AIBehaviors fsm)
 {
 }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
 protected override void Init(AIBehaviors fsm)
 {
     sqrDistanceToTargetThreshold = GetSquareDistanceThreshold();
     fsm.PlayAudio();
 }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
 protected override void Init(AIBehaviors fsm)
 {
     transformPreviousPositions = new Dictionary <Transform, Vector3>();
     previousCheckTime          = Time.time;
 }