コード例 #1
0
 protected override bool Reason(AIBehaviors fsm)
 {
     return(true);
 }
コード例 #2
0
 void HandleTargetReached(AIBehaviors fsm)
 {
     targetPosition = GetTargetPoint(fsm);
 }
コード例 #3
0
 protected override void StateEnded(AIBehaviors fsm)
 {
 }
コード例 #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();
            }
        }
コード例 #5
0
ファイル: SeekState.cs プロジェクト: gary9716/NTU_CGHW2
 protected override void Init(AIBehaviors fsm)
 {
     sqrDistanceToTargetThreshold = GetSquareDistanceThreshold();
     fsm.PlayAudio();
 }
コード例 #6
0
ファイル: SeekState.cs プロジェクト: gary9716/NTU_CGHW2
        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();
        }
コード例 #7
0
 protected override void Init(AIBehaviors fsm)
 {
     transformPreviousPositions = new Dictionary <Transform, Vector3>();
     previousCheckTime          = Time.time;
 }