├── .github └── FUNDING.yml ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Editor.meta ├── Editor ├── ScriptableStatesComponentEditor.cs ├── ScriptableStatesComponentEditor.cs.meta ├── loophouse.ScriptableStates.Editor.asmdef └── loophouse.ScriptableStates.Editor.asmdef.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── ScriptableAction.cs ├── ScriptableAction.cs.meta ├── ScriptableCondition.cs ├── ScriptableCondition.cs.meta ├── ScriptableState.cs ├── ScriptableState.cs.meta ├── ScriptableStateMachine.cs ├── ScriptableStateMachine.cs.meta ├── StateComponent.cs ├── StateComponent.cs.meta ├── StateTransition.cs ├── StateTransition.cs.meta ├── _EmptyState.asset ├── _EmptyState.asset.meta ├── loophouse.ScriptableStates.asmdef └── loophouse.ScriptableStates.asmdef.meta ├── Samples~ ├── FollowBehaviourExample.meta ├── FollowBehaviourExample │ ├── Input.meta │ ├── Input │ │ ├── GameControls.inputactions │ │ └── GameControls.inputactions.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Enemy.prefab │ │ ├── Enemy.prefab.meta │ │ ├── Player.prefab │ │ └── Player.prefab.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── FollowBehaviourExample.unity │ │ └── FollowBehaviourExample.unity.meta │ ├── ScriptableAssets.meta │ ├── ScriptableAssets │ │ ├── Actions.meta │ │ ├── Actions │ │ │ ├── Enemy_ColorFollowing.asset │ │ │ ├── Enemy_ColorFollowing.asset.meta │ │ │ ├── Enemy_ColorRecovering.asset │ │ │ ├── Enemy_ColorRecovering.asset.meta │ │ │ ├── Enemy_ColorSeeking.asset │ │ │ ├── Enemy_ColorSeeking.asset.meta │ │ │ ├── Enemy_Move.asset │ │ │ ├── Enemy_Move.asset.meta │ │ │ ├── Player_ColorNormal.asset │ │ │ ├── Player_ColorNormal.asset.meta │ │ │ ├── Player_ColorRecovering.asset │ │ │ ├── Player_ColorRecovering.asset.meta │ │ │ ├── Player_ColorRunning.asset │ │ │ ├── Player_ColorRunning.asset.meta │ │ │ ├── Player_Move1.asset │ │ │ ├── Player_Move1.asset.meta │ │ │ ├── Player_Move2.asset │ │ │ ├── Player_Move2.asset.meta │ │ │ ├── Stamina_Consume.asset │ │ │ ├── Stamina_Consume.asset.meta │ │ │ ├── Stamina_Recover.asset │ │ │ └── Stamina_Recover.asset.meta │ │ ├── Conditions.meta │ │ ├── Conditions │ │ │ ├── Enemy_FollowRadius.asset │ │ │ ├── Enemy_FollowRadius.asset.meta │ │ │ ├── Enemy_SeekRadius.asset │ │ │ ├── Enemy_SeekRadius.asset.meta │ │ │ ├── Input_Run.asset │ │ │ ├── Input_Run.asset.meta │ │ │ ├── Stamina_Depleted.asset │ │ │ ├── Stamina_Depleted.asset.meta │ │ │ ├── Stamina_Full.asset │ │ │ └── Stamina_Full.asset.meta │ │ ├── StateMachines.meta │ │ ├── StateMachines │ │ │ ├── EnemyStateMachine.asset │ │ │ ├── EnemyStateMachine.asset.meta │ │ │ ├── PlayerStateMachine.asset │ │ │ └── PlayerStateMachine.asset.meta │ │ ├── States.meta │ │ └── States │ │ │ ├── Enemy_Following.asset │ │ │ ├── Enemy_Following.asset.meta │ │ │ ├── Enemy_Recovering.asset │ │ │ ├── Enemy_Recovering.asset.meta │ │ │ ├── Enemy_Seeking.asset │ │ │ ├── Enemy_Seeking.asset.meta │ │ │ ├── Player_Normal.asset │ │ │ ├── Player_Normal.asset.meta │ │ │ ├── Player_Recovering.asset │ │ │ ├── Player_Recovering.asset.meta │ │ │ ├── Player_Running.asset │ │ │ └── Player_Running.asset.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Actions.meta │ │ ├── Actions │ │ │ ├── ChangeSpriteColorAction.cs │ │ │ ├── ChangeSpriteColorAction.cs.meta │ │ │ ├── ConsumeStaminaAction.cs │ │ │ ├── ConsumeStaminaAction.cs.meta │ │ │ ├── MovementAction.cs │ │ │ ├── MovementAction.cs.meta │ │ │ ├── RecoverStaminaAction.cs │ │ │ └── RecoverStaminaAction.cs.meta │ │ ├── Components.meta │ │ ├── Components │ │ │ ├── EnemyComponent.cs │ │ │ ├── EnemyComponent.cs.meta │ │ │ ├── PlayerComponent.cs │ │ │ ├── PlayerComponent.cs.meta │ │ │ ├── StaminaComponent.cs │ │ │ └── StaminaComponent.cs.meta │ │ ├── Conditions.meta │ │ ├── Conditions │ │ │ ├── InputCondition.cs │ │ │ ├── InputCondition.cs.meta │ │ │ ├── RadialTargetDetectionCondition.cs │ │ │ ├── RadialTargetDetectionCondition.cs.meta │ │ │ ├── StaminaCheckCondition.cs │ │ │ └── StaminaCheckCondition.cs.meta │ │ ├── Interfaces.meta │ │ └── Interfaces │ │ │ ├── IMovable.cs │ │ │ └── IMovable.cs.meta │ ├── Sprites.meta │ └── Sprites │ │ ├── Enemy.png │ │ ├── Enemy.png.meta │ │ ├── Player.png │ │ ├── Player.png.meta │ │ ├── Square.png │ │ └── Square.png.meta └── ScriptTemplates │ ├── 82a-Scriptable Action Script-NewScriptableActionScript.cs.txt │ └── 82b-Scriptable Condition Script-NewScriptableConditionScript.cs.txt ├── Third Party Notices.md ├── Third Party Notices.md.meta ├── package.json └── package.json.meta /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: devoliveiras 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased] 8 | --- 9 | 10 | ## [0.4.0] - 2021-06-05 11 | ### Added 12 | - New ScriptableStateMachine class, containing a list of all possible transitions for that state machine, making states more reusable. 13 | - New callback OnStateChanged for the StateComponent, with both previous and current state as parameters. 14 | - New Stamina bar for the Follow Behaviour Example 15 | 16 | ### Changed 17 | - ScriptableStatesComponent now only have a reference to the ScriptableStateMachine, that has the references to the initial state and empty state for that machine. 18 | - ScriptableState no longer has a list of transitions. Entry actions, exit actions, physics actions and state actions remain. 19 | - ScriptableStateComponent becomes StateComponent. 20 | 21 | ### Removed 22 | - ReorderableList package has been removed. It is recommended to use Unity 2020.3 or higher from now on. (lists and arrays are now reorderable on Unity) 23 | 24 | --- 25 | ## [0.3.1] - 2021-06-03 26 | ### Fixed 27 | - Removed unused imports (UnityEditorInternal) on scripts causing builds to fail. 28 | 29 | 30 | ## [0.3.0] - 2020-11-09 31 | ### Changed 32 | - Company name changed from devludico to loophouse. 33 | - The namespace devludico was changed to loophouse. 34 | - Updated README (now it has some gifs!) 35 | 36 | --- 37 | ## [0.2.0] - 2020-09-02 38 | ### Added 39 | - New Sample Folder - Follow Behaviour Example, with some use example. 40 | - New Inspector UI for ScriptableStatesComponent. 41 | - New logs for errors, highlighting the correct object or scriptable that caused it. 42 | - Description for the Follow Behaviour Example into the README Samples Section. 43 | - Version tag into the README file. 44 | 45 | ### Changed 46 | - ScriptableCondition Verify parameter name changed from smComponent to statesComponent, as in ScriptableAction's Act method. 47 | 48 | ## [0.1.0] - 2020-06-14 49 | ### Added 50 | - Base scripts of the tool, ScriptableState, ScriptableAction and ScriptableCondition. 51 | - Sample folder with a usability trick. 52 | - Instalation and use guide into the README file. 53 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b856df9603938fd4e8e8a2fec66c7160 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1150d87620900ac47aaa2b3efba882c2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/ScriptableStatesComponentEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace loophouse.ScriptableStates 5 | { 6 | [CustomEditor(typeof(StateComponent))] 7 | public class ScriptableStatesComponentEditor : Editor 8 | { 9 | Color _rectColor; 10 | GUIStyle _richTextStyle; 11 | private void OnEnable() 12 | { 13 | _rectColor = new Color(0, 0, 0, 0.2f); 14 | _richTextStyle = new GUIStyle() { richText = true }; 15 | } 16 | 17 | public override void OnInspectorGUI() 18 | { 19 | serializedObject.Update(); 20 | 21 | EditorGUILayout.Space(); 22 | EditorGUILayout.ObjectField(serializedObject.FindProperty("_stateMachine")); 23 | if (!serializedObject.FindProperty("_stateMachine").objectReferenceValue) 24 | EditorGUILayout.HelpBox("State Machine missing, select a state machine to run.", MessageType.Warning, true); 25 | 26 | EditorGUILayout.Space(); 27 | Rect horizontalGroup = EditorGUILayout.BeginHorizontal(); 28 | EditorGUI.DrawRect(horizontalGroup, _rectColor); 29 | EditorGUILayout.LabelField(" Current State:", _richTextStyle); 30 | GUILayout.Box(GetCurrentStateName(), _richTextStyle); 31 | EditorGUILayout.EndHorizontal(); 32 | 33 | serializedObject.ApplyModifiedProperties(); 34 | } 35 | 36 | private string GetCurrentStateName() 37 | { 38 | StateComponent component = serializedObject.targetObject as StateComponent; 39 | if (component.CurrentState) 40 | return $"{component.CurrentState.name}"; 41 | else 42 | return "None"; 43 | } 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Editor/ScriptableStatesComponentEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b6c9c2b37422c1459b9b7b8194ac2c0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/loophouse.ScriptableStates.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loophouse.ScriptableStates.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:5be546b8e968dae4c95d4ab05b94a01e" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Editor/loophouse.ScriptableStates.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3a730e0fafe75244a2644d8f76c1e34 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Luis Oliveira 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86bd087eb17c91749839e3a81cc07841 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scriptable States 2 | ![GitHub release (latest by date)](https://img.shields.io/github/v/release/luisoliveiras/scriptable-states?label=current%20release) 3 | ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/luisoliveiras/scriptable-states/develop?label=develop) 4 | 5 | 6 | ## What is this? 7 | Scriptable States is a `ScriptableObject` based implementaton of a Finite State Machine. 8 | It's main purpose is to create reusable behaviour bits like the `ScriptableAction` and the `ScriptableCondition`, and be able to create and edit a `ScriptableState` using those actions and sequencing those states with a `ScriptableStateMachine` setting transitions with those conditions to create unique behaviour through the editor. 9 | 10 | --- 11 | ## Installation: 12 | ##### On Unity 2018.4: 13 | Download this package to your disk. 14 | Open the package manager on _**Window > Package Manager**_ and select the **+** button and click on the **Add package from disk...** option and then add the ScriptableStates package. 15 | 16 | ##### On Unity 2019.1 and above: 17 | Open the project manifest file under the Packages folder and add these lines to the dependencies: 18 | ```json 19 | "dependencies": { 20 | ... 21 | "com.loophouse.scriptable-states":"https://github.com/luisoliveiras/scriptable-states.git#v0.4.0", 22 | ... 23 | } 24 | 25 | ``` 26 | 27 | ##### On Unity 2019.3 and above: 28 | Open the package manager on _**Window > Package Manager**_ and select the **+** button and click on the **Add package from git URL...** option and then add the ScriptableStates package link: 29 | https://github.com/luisoliveiras/scriptable-states.git#v0.4.0 30 | 31 | _\* You can also add it from disk if you want, just follow the steps from 2018.4 install guide._\ 32 | _\** You can can choose another version of the tool by changing the end of the link (#v0.4.0) for the version you want. Versions under v0.4.0 have a dependency on the reorderable list package._ 33 | 34 | 35 | --- 36 | ## How to Use 37 | #### Setting up a State: 38 | Access _**Create > Scriptable State Machine > State**_ like the image below. 39 | ![Scriptable State on Create Menu](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/create_menu_state_02.png?raw=true) 40 | 41 | Select a name for your state and you should be ready to use it. The image below is what you should get from creating a state asset. 42 | 43 | ![Scriptable State Asset on Inspector](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/inspector_state_01.png?raw=true) 44 | 45 | As you can see from the image, a state contains five lists: **Entry Actions**, **Exit Actions**, **Physics Actions** and **State Actions**. 46 | - **Entry Actions** are excecuted only once, when there is a transition to the state. 47 | - **Exit Actions** are executed only once, when there is a transition from the state. 48 | - **Physics Actions** are executed in the `FixedUpdate()` method. 49 | - **State Actions** are executed in the `Update()` method. 50 | 51 | #### Creating a State Machine 52 | Access _**Create > Scriptable State Machine > State Machine**_ like the image below. 53 | ![Scriptable State on Create Menu](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/create_menu_state_machine_01.png?raw=true) 54 | 55 | To set up a **State Machine** you will need an _Initial State_, from where your state machine will start, an _Empty State_ reference, which will be used when comparing the transitions responses and a list of all possible _Transitions_ for that state machine. 56 | 57 | ![Scriptable State Machine Inspector](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/inspector_state_machine_01.png?raw=true) 58 | 59 | **Transitions** are executed in the `LateUpdate()` method of the `StateComponent`, where based on the current state of the state machine a condition will be tested, triggering a move (or not) to the next state. A _Transition_ contains a _Origin State_ that will be compared to the current state, a `ScriptableCondition` that will be tested, a _True State_, achieved when the condition is met, and a _False State_ when not. 60 | 61 | ![Scriptable State Machine Transition on Inspector](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/inspector_transition_01.png?raw=true) 62 | 63 | #### Creating Actions 64 | Create a _C#_ script inheriting from `ScriptableAction` and add a CreateMenu attribute to it like in the example below: 65 | 66 | ```csharp 67 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/MyAction", fileName = "new MyAction")] 68 | public class MyAction : ScriptableAction 69 | { 70 | //Add some variables here to setup your action 71 | public override void Act(StateComponent stateComponent) 72 | { 73 | // put your code here 74 | // You can use the stateComponent to get other components in your game object 75 | } 76 | } 77 | ``` 78 | With this done, you're ready to create some action from the **_Create > Scriptable State Machine > Actions_** menu. By adding variables to your action and making them visible in the inspector, you can create variations for that action, like a _MoveAction_ with different values for speed. 79 | 80 | #### Creating Conditions 81 | Create a _C#_ script inheriting from `ScriptableCondition` and add a CreateMenu attribute to it like in the example below: 82 | 83 | ```csharp 84 | [CreateAssetMenu(menuName = "Scriptable State Machine/Conditions/MyCondition", fileName = "new MyCondition")] 85 | public class MyCondition : ScriptableCondition 86 | { 87 | //Add some variables here to setup your condition 88 | public override bool Verify(StateComponent stateComponent) 89 | { 90 | // put your code here 91 | // You can use the stateComponent to get other components in your game object 92 | } 93 | } 94 | ``` 95 | With this step completed, it is now possible to create a condition from the **_Create > Scriptable State Machine > Conditions_** menu and start setting up your states' transitions. The states transitions uses the value returned from the condition's Verify method to determine if should go to the state referenced in the _True State_ or _False State_. 96 | You can add variables and set them visible in the inspector to create variations of that condition, like a _DetectionCondition_ that uses a float to determine the detection radius. 97 | 98 | #### Creating the State Component 99 | Create the `GameObject` that will driven by the state machine, in the Inspector, click in **Add Component** and search for `StateComponent` and add it to your game object. 100 | 101 | ![States Component](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/inspector_state_component_1.gif?raw=true) 102 | 103 | To set up this component, add a `ScriptableStateMachine` on the _State Machine_ field. By doing this, the `StateComponent` will start on the _Initial State_ set on the _State Machine_, running its _actions_ while testing the _State Machine_'s _transitions_ for new states. While in play mode, the _Current State_ will show the current state of this component in green and if something go wrong with your states or if it is not in play mode, it will show "_None_" in red. 104 | 105 | Following this steps you should not have problems setting up your states machines. 106 | 107 | \* When creating your actions and conditions, remember that they can be used by more then one object, and you should not change the values of the variables added to them in runtime, or you'll change the value for all the objects using them, unless that's your expected behaviour. Think of the values you expose in the actions and conditions editor as constants for that behaviour piece. 108 | 109 | --- 110 | ## Samples 111 | #### Script Templates: 112 | 113 | **What:** It adds create menu options to make it easier to create a `ScriptableAction` or `ScriptableCondition` script by adding them to the _Create menu_ with all the information they need. 114 | 115 | ![Scriptable Action Script on Create Menu](https://raw.githubusercontent.com/luisoliveiras/project-images/master/scriptable-states/create_menu_action_script_01.png?token=ADU3KQA32EBV5SCMUFPBPUK64WT64) 116 | 117 | ![Scriptable Condition Script on Create Menu](https://raw.githubusercontent.com/luisoliveiras/project-images/master/scriptable-states/create_menu_condition_script_01.png?token=ADU3KQGNMLPQYYMZDTZSECK64WT2O) 118 | 119 | **How:** Move the _ScriptTemplates_ folder from _Samples_ to your _Assets_ folder (root) and restart the editor. The _"Scriptable Action Script"_ and _"Scriptable Condition Script"_ options will be available under the Create menu options. If you already have a ScriptTemplates folder in your project, just move the assets inside the _Samples/ScriptTemplates_ folder to it and restart the editor. 120 | 121 | #### Follow Behavior Example: 122 | 123 | **What:** A Simple implementation of movement, stamina and follow behaviour using _scriptable states, scriptable state machines, actions and conditions_. 124 | 125 | ![Follow Behaviour Example](https://github.com/luisoliveiras/project-images/blob/master/scriptable-states/v0.4.0/follow_behaviour_example.gif?raw=true) 126 | 127 | 128 | **How:** Install the sample from the Package Manager UI. Open the _FollowBehaviourExample_ scene inside the _Follow Behaviour Example_ folder added to your project's _Assets_ folder and you're ready to go. 129 | _\* This sample requires the new unity Input System to work._ 130 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b855b21a0efe5e8458b5690647461802 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 162ee2c05cab68b439951f0529ec66e7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace loophouse.ScriptableStates 6 | { 7 | public abstract class ScriptableAction : ScriptableObject 8 | { 9 | public abstract void Act(StateComponent statesComponent); 10 | } 11 | } -------------------------------------------------------------------------------- /Runtime/ScriptableAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 518310d984c77984b841cfff71ecf115 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableCondition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace loophouse.ScriptableStates 6 | { 7 | public abstract class ScriptableCondition : ScriptableObject 8 | { 9 | public abstract bool Verify(StateComponent statesComponent); 10 | } 11 | } -------------------------------------------------------------------------------- /Runtime/ScriptableCondition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82172188dd2ddb243853dd1ecd701231 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableState.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace loophouse.ScriptableStates 4 | { 5 | [CreateAssetMenu(menuName = "Scriptable State Machine/State", fileName = "State")] 6 | public class ScriptableState : ScriptableObject 7 | { 8 | [SerializeField] ScriptableAction[] _entryActions; 9 | [SerializeField] ScriptableAction[] _exitActions; 10 | [SerializeField] ScriptableAction[] _physicsActions; //to be run in fixed update 11 | [SerializeField] ScriptableAction[] _stateActions; //to be run in update 12 | 13 | public void Begin(StateComponent stateComponent) 14 | { 15 | foreach (var action in _entryActions) 16 | { 17 | if (action) 18 | { 19 | action.Act(stateComponent); 20 | } 21 | else 22 | { 23 | Debug.LogError($"[SCRIPTABLE STATE] {name}'s Entry Actions list has a null element", this); 24 | } 25 | } 26 | } 27 | 28 | public void End(StateComponent stateComponent) 29 | { 30 | foreach (var action in _exitActions) 31 | { 32 | if (action) 33 | { 34 | action.Act(stateComponent); 35 | } 36 | else 37 | { 38 | Debug.LogError($"[SCRIPTABLE STATE] {name}'s Exit Actions list has a null element", this); 39 | } 40 | } 41 | } 42 | 43 | public void UpdatePhysics(StateComponent stateComponent) 44 | { 45 | foreach (var action in _physicsActions) 46 | { 47 | if (action) 48 | { 49 | action.Act(stateComponent); 50 | } 51 | else 52 | { 53 | Debug.LogError($"[SCRIPTABLE STATE] {name}'s Physics Actions list has a null element", this); 54 | } 55 | } 56 | } 57 | 58 | public void UpdateState(StateComponent stateComponent) 59 | { 60 | foreach (var action in _stateActions) 61 | { 62 | if (action) 63 | { 64 | action.Act(stateComponent); 65 | } 66 | else 67 | { 68 | Debug.LogError($"[SCRIPTABLE STATE] {name}'s State Actions list has a null element", this); 69 | } 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Runtime/ScriptableState.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 499f9dc307232184ca30934e3fc72ee2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableStateMachine.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace loophouse.ScriptableStates 6 | { 7 | [CreateAssetMenu(menuName = "Scriptable State Machine/State Machine", fileName = "State Machine")] 8 | public class ScriptableStateMachine : ScriptableObject 9 | { 10 | [SerializeField] private ScriptableState _initialState; 11 | [SerializeField] private ScriptableState _emptyState; 12 | [SerializeField] private List _transitions; 13 | 14 | public ScriptableState InitialState { get => _initialState; } 15 | public ScriptableState EmptyState { get => _emptyState; } 16 | 17 | public ScriptableState CheckTransitions(StateComponent stateComponent, ScriptableState currentState) 18 | { 19 | foreach (StateTransition transition in _transitions) 20 | { 21 | if (transition.originState == currentState) 22 | { 23 | if (transition.condition) 24 | { 25 | if (transition.condition.Verify(stateComponent)) 26 | { 27 | if (transition.trueState != _emptyState) 28 | { 29 | if (transition.trueState) 30 | { 31 | return transition.trueState; 32 | } 33 | else 34 | { 35 | Debug.LogError($"[SCRIPTABLE STATE MACHINE] {name}'s Transitions list has an element with a null true state", this); 36 | } 37 | } 38 | } 39 | else 40 | { 41 | if (transition.falseState != _emptyState) 42 | { 43 | if (transition.falseState) 44 | { 45 | return transition.falseState; 46 | } 47 | else 48 | { 49 | Debug.LogError($"[SCRIPTABLE STATE MACHINE] {name}'s Transitions list has an element with a null false state", this); 50 | } 51 | } 52 | } 53 | } 54 | else 55 | { 56 | Debug.LogError($"[SCRIPTABLE STATE MACHINE] {name}'s Transitions list has an element with a null condition", this); 57 | } 58 | } 59 | } 60 | return _emptyState; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Runtime/ScriptableStateMachine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 718ecb92f024ea14e8d2f2450ca5def2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/StateComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace loophouse.ScriptableStates 5 | { 6 | public class StateComponent : MonoBehaviour 7 | { 8 | [SerializeField] private ScriptableStateMachine _stateMachine; 9 | private ScriptableState _currentState; 10 | 11 | public ScriptableState CurrentState { get => _currentState; } 12 | /// 13 | /// T1: Previous State, T2: Current State 14 | /// 15 | public Action OnStateChanged; 16 | 17 | private void Start() 18 | { 19 | if (!_stateMachine.InitialState) 20 | { 21 | Debug.LogError($"{_stateMachine.name} has no initial state attached to it, the state machine can't be initialized.", this); 22 | return; 23 | } 24 | 25 | _currentState = _stateMachine.InitialState; 26 | _currentState.Begin(this); 27 | } 28 | 29 | private void FixedUpdate() 30 | { 31 | if (!_currentState) 32 | return; 33 | 34 | _currentState.UpdatePhysics(this); 35 | } 36 | 37 | private void Update() 38 | { 39 | if (!_currentState) 40 | return; 41 | 42 | _currentState.UpdateState(this); 43 | } 44 | 45 | private void LateUpdate() 46 | { 47 | if (!_currentState) 48 | return; 49 | 50 | CheckTransitions(); 51 | } 52 | 53 | public void CheckTransitions() 54 | { 55 | ScriptableState nextState = _stateMachine.CheckTransitions(this, _currentState); 56 | if (nextState != _stateMachine.EmptyState) 57 | { 58 | _currentState.End(this); 59 | var previousState = CurrentState; 60 | _currentState = nextState; 61 | _currentState.Begin(this); 62 | 63 | OnStateChanged?.Invoke(previousState,nextState); 64 | } 65 | } 66 | 67 | } 68 | } -------------------------------------------------------------------------------- /Runtime/StateComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e764c36fb780ad408dea0bebbe5a694 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/StateTransition.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace loophouse.ScriptableStates 3 | { 4 | [System.Serializable] 5 | public struct StateTransition 6 | { 7 | public ScriptableState originState; 8 | public ScriptableCondition condition; 9 | public ScriptableState trueState; 10 | public ScriptableState falseState; 11 | } 12 | } -------------------------------------------------------------------------------- /Runtime/StateTransition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a451ee708b4714449e1e2e885b37d3f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/_EmptyState.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: _EmptyState 14 | m_EditorClassIdentifier: 15 | _entryActions: [] 16 | _exitActions: [] 17 | _physicsActions: [] 18 | _stateActions: [] 19 | _transitions: [] 20 | -------------------------------------------------------------------------------- /Runtime/_EmptyState.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20352fc7a011e8748b8ba85265763ede 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/loophouse.ScriptableStates.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loophouse.ScriptableStates", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [], 6 | "allowUnsafeCode": false, 7 | "overrideReferences": false, 8 | "precompiledReferences": [], 9 | "autoReferenced": true, 10 | "defineConstraints": [], 11 | "versionDefines": [], 12 | "noEngineReferences": false 13 | } -------------------------------------------------------------------------------- /Runtime/loophouse.ScriptableStates.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5be546b8e968dae4c95d4ab05b94a01e 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44e1d5d712a1dac4d999d4cb96e47439 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Input.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 148a0ab5df37a5f4ea1104648b197671 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Input/GameControls.inputactions: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GameControls", 3 | "maps": [ 4 | { 5 | "name": "Player", 6 | "id": "337f4a2f-2db6-4cc8-a9bb-7c386dced5a5", 7 | "actions": [ 8 | { 9 | "name": "MoveControl", 10 | "type": "Value", 11 | "id": "235dd5f2-0741-461e-839f-7dbf0fda8860", 12 | "expectedControlType": "Vector2", 13 | "processors": "", 14 | "interactions": "" 15 | }, 16 | { 17 | "name": "Run", 18 | "type": "Button", 19 | "id": "770b6874-f6de-49e0-ba4d-54b3102a7d98", 20 | "expectedControlType": "Button", 21 | "processors": "", 22 | "interactions": "" 23 | } 24 | ], 25 | "bindings": [ 26 | { 27 | "name": "WASD", 28 | "id": "dc3ce9d5-964e-46de-95de-88835e28c1c6", 29 | "path": "2DVector", 30 | "interactions": "", 31 | "processors": "", 32 | "groups": "", 33 | "action": "MoveControl", 34 | "isComposite": true, 35 | "isPartOfComposite": false 36 | }, 37 | { 38 | "name": "up", 39 | "id": "df7c2a25-0db2-4366-908f-b44c490abf6e", 40 | "path": "/w", 41 | "interactions": "", 42 | "processors": "", 43 | "groups": "", 44 | "action": "MoveControl", 45 | "isComposite": false, 46 | "isPartOfComposite": true 47 | }, 48 | { 49 | "name": "down", 50 | "id": "7db6fd56-ed63-4ee0-94f6-eb3b7f5c5abd", 51 | "path": "/s", 52 | "interactions": "", 53 | "processors": "", 54 | "groups": "", 55 | "action": "MoveControl", 56 | "isComposite": false, 57 | "isPartOfComposite": true 58 | }, 59 | { 60 | "name": "left", 61 | "id": "868a788d-785d-49fa-8afd-6acfdb80d9d5", 62 | "path": "/a", 63 | "interactions": "", 64 | "processors": "", 65 | "groups": "", 66 | "action": "MoveControl", 67 | "isComposite": false, 68 | "isPartOfComposite": true 69 | }, 70 | { 71 | "name": "right", 72 | "id": "fc2fb771-82fe-4d16-8bc9-f5cfb269c1be", 73 | "path": "/d", 74 | "interactions": "", 75 | "processors": "", 76 | "groups": "", 77 | "action": "MoveControl", 78 | "isComposite": false, 79 | "isPartOfComposite": true 80 | }, 81 | { 82 | "name": "", 83 | "id": "e064b080-b87d-476c-8683-13b9c5c29e78", 84 | "path": "/space", 85 | "interactions": "", 86 | "processors": "", 87 | "groups": "", 88 | "action": "Run", 89 | "isComposite": false, 90 | "isPartOfComposite": false 91 | } 92 | ] 93 | } 94 | ], 95 | "controlSchemes": [] 96 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Input/GameControls.inputactions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7aab555a5183a424f800a5c606d2208e 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} 11 | generateWrapperCode: 0 12 | wrapperCodePath: 13 | wrapperClassName: 14 | wrapperCodeNamespace: 15 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 242f1f5a4d781874b9295a98f50079eb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Prefabs/Enemy.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1744324491250938977 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1744324491250938991} 12 | - component: {fileID: 1744324491250938988} 13 | - component: {fileID: 1744324491250938990} 14 | - component: {fileID: 1744324491250938989} 15 | - component: {fileID: 1744324491250938986} 16 | - component: {fileID: 8917870640567201506} 17 | - component: {fileID: 97359764655294241} 18 | m_Layer: 9 19 | m_Name: Enemy 20 | m_TagString: Untagged 21 | m_Icon: {fileID: 0} 22 | m_NavMeshLayer: 0 23 | m_StaticEditorFlags: 0 24 | m_IsActive: 1 25 | --- !u!4 &1744324491250938991 26 | Transform: 27 | m_ObjectHideFlags: 0 28 | m_CorrespondingSourceObject: {fileID: 0} 29 | m_PrefabInstance: {fileID: 0} 30 | m_PrefabAsset: {fileID: 0} 31 | m_GameObject: {fileID: 1744324491250938977} 32 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 33 | m_LocalPosition: {x: 7.41, y: 0.06, z: 0} 34 | m_LocalScale: {x: 1, y: 1, z: 1} 35 | m_Children: 36 | - {fileID: 3346478602631505555} 37 | m_Father: {fileID: 0} 38 | m_RootOrder: 0 39 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 40 | --- !u!212 &1744324491250938988 41 | SpriteRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 1744324491250938977} 47 | m_Enabled: 1 48 | m_CastShadows: 0 49 | m_ReceiveShadows: 0 50 | m_DynamicOccludee: 1 51 | m_MotionVectors: 1 52 | m_LightProbeUsage: 1 53 | m_ReflectionProbeUsage: 1 54 | m_RayTracingMode: 0 55 | m_RayTraceProcedural: 0 56 | m_RenderingLayerMask: 1 57 | m_RendererPriority: 0 58 | m_Materials: 59 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 60 | m_StaticBatchInfo: 61 | firstSubMesh: 0 62 | subMeshCount: 0 63 | m_StaticBatchRoot: {fileID: 0} 64 | m_ProbeAnchor: {fileID: 0} 65 | m_LightProbeVolumeOverride: {fileID: 0} 66 | m_ScaleInLightmap: 1 67 | m_ReceiveGI: 1 68 | m_PreserveUVs: 0 69 | m_IgnoreNormalsForChartDetection: 0 70 | m_ImportantGI: 0 71 | m_StitchLightmapSeams: 1 72 | m_SelectedEditorRenderState: 0 73 | m_MinimumChartSize: 4 74 | m_AutoUVMaxDistance: 0.5 75 | m_AutoUVMaxAngle: 89 76 | m_LightmapParameters: {fileID: 0} 77 | m_SortingLayerID: 0 78 | m_SortingLayer: 0 79 | m_SortingOrder: 0 80 | m_Sprite: {fileID: 21300000, guid: 30e08f7c73558ea4b9be14e39fb55d86, type: 3} 81 | m_Color: {r: 1, g: 1, b: 1, a: 1} 82 | m_FlipX: 0 83 | m_FlipY: 0 84 | m_DrawMode: 0 85 | m_Size: {x: 1, y: 1} 86 | m_AdaptiveModeThreshold: 0.5 87 | m_SpriteTileMode: 0 88 | m_WasSpriteAssigned: 1 89 | m_MaskInteraction: 0 90 | m_SpriteSortPoint: 0 91 | --- !u!114 &1744324491250938990 92 | MonoBehaviour: 93 | m_ObjectHideFlags: 0 94 | m_CorrespondingSourceObject: {fileID: 0} 95 | m_PrefabInstance: {fileID: 0} 96 | m_PrefabAsset: {fileID: 0} 97 | m_GameObject: {fileID: 1744324491250938977} 98 | m_Enabled: 1 99 | m_EditorHideFlags: 0 100 | m_Script: {fileID: 11500000, guid: 0e764c36fb780ad408dea0bebbe5a694, type: 3} 101 | m_Name: 102 | m_EditorClassIdentifier: 103 | _stateMachine: {fileID: 11400000, guid: ddefda1cc53ccf848bbf505cce7fe01e, type: 2} 104 | --- !u!114 &1744324491250938989 105 | MonoBehaviour: 106 | m_ObjectHideFlags: 0 107 | m_CorrespondingSourceObject: {fileID: 0} 108 | m_PrefabInstance: {fileID: 0} 109 | m_PrefabAsset: {fileID: 0} 110 | m_GameObject: {fileID: 1744324491250938977} 111 | m_Enabled: 1 112 | m_EditorHideFlags: 0 113 | m_Script: {fileID: 11500000, guid: 6f3772f071b62cc428a1e0581acfa7a5, type: 3} 114 | m_Name: 115 | m_EditorClassIdentifier: 116 | --- !u!50 &1744324491250938986 117 | Rigidbody2D: 118 | serializedVersion: 4 119 | m_ObjectHideFlags: 0 120 | m_CorrespondingSourceObject: {fileID: 0} 121 | m_PrefabInstance: {fileID: 0} 122 | m_PrefabAsset: {fileID: 0} 123 | m_GameObject: {fileID: 1744324491250938977} 124 | m_BodyType: 0 125 | m_Simulated: 1 126 | m_UseFullKinematicContacts: 0 127 | m_UseAutoMass: 0 128 | m_Mass: 1 129 | m_LinearDrag: 0 130 | m_AngularDrag: 0.05 131 | m_GravityScale: 0 132 | m_Material: {fileID: 0} 133 | m_Interpolate: 0 134 | m_SleepingMode: 1 135 | m_CollisionDetection: 0 136 | m_Constraints: 4 137 | --- !u!58 &8917870640567201506 138 | CircleCollider2D: 139 | m_ObjectHideFlags: 0 140 | m_CorrespondingSourceObject: {fileID: 0} 141 | m_PrefabInstance: {fileID: 0} 142 | m_PrefabAsset: {fileID: 0} 143 | m_GameObject: {fileID: 1744324491250938977} 144 | m_Enabled: 1 145 | m_Density: 1 146 | m_Material: {fileID: 0} 147 | m_IsTrigger: 0 148 | m_UsedByEffector: 0 149 | m_UsedByComposite: 0 150 | m_Offset: {x: 0, y: 0} 151 | serializedVersion: 2 152 | m_Radius: 0.5 153 | --- !u!114 &97359764655294241 154 | MonoBehaviour: 155 | m_ObjectHideFlags: 0 156 | m_CorrespondingSourceObject: {fileID: 0} 157 | m_PrefabInstance: {fileID: 0} 158 | m_PrefabAsset: {fileID: 0} 159 | m_GameObject: {fileID: 1744324491250938977} 160 | m_Enabled: 1 161 | m_EditorHideFlags: 0 162 | m_Script: {fileID: 11500000, guid: 5c6443cccb9365040ba4e2ab785bb153, type: 3} 163 | m_Name: 164 | m_EditorClassIdentifier: 165 | _maxStamina: 20 166 | _currentStamina: 0 167 | _dropPerSecond: 4 168 | _recoverPerSecond: 5 169 | _staminaBar: {fileID: 5970427988234876681} 170 | --- !u!1 &8067412394937766965 171 | GameObject: 172 | m_ObjectHideFlags: 0 173 | m_CorrespondingSourceObject: {fileID: 0} 174 | m_PrefabInstance: {fileID: 0} 175 | m_PrefabAsset: {fileID: 0} 176 | serializedVersion: 6 177 | m_Component: 178 | - component: {fileID: 3346478602631505555} 179 | - component: {fileID: 4674209861006048712} 180 | - component: {fileID: 2636598610291134728} 181 | - component: {fileID: 5500647036073789418} 182 | m_Layer: 5 183 | m_Name: CharacterUI 184 | m_TagString: Untagged 185 | m_Icon: {fileID: 0} 186 | m_NavMeshLayer: 0 187 | m_StaticEditorFlags: 0 188 | m_IsActive: 1 189 | --- !u!224 &3346478602631505555 190 | RectTransform: 191 | m_ObjectHideFlags: 0 192 | m_CorrespondingSourceObject: {fileID: 0} 193 | m_PrefabInstance: {fileID: 0} 194 | m_PrefabAsset: {fileID: 0} 195 | m_GameObject: {fileID: 8067412394937766965} 196 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 197 | m_LocalPosition: {x: 0, y: 0, z: 0} 198 | m_LocalScale: {x: 1, y: 1, z: 1} 199 | m_Children: 200 | - {fileID: 9222872215573194216} 201 | m_Father: {fileID: 1744324491250938991} 202 | m_RootOrder: 0 203 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 204 | m_AnchorMin: {x: 0, y: 0} 205 | m_AnchorMax: {x: 0, y: 0} 206 | m_AnchoredPosition: {x: 0, y: 0} 207 | m_SizeDelta: {x: 2, y: 2} 208 | m_Pivot: {x: 0.5, y: 0.5} 209 | --- !u!223 &4674209861006048712 210 | Canvas: 211 | m_ObjectHideFlags: 0 212 | m_CorrespondingSourceObject: {fileID: 0} 213 | m_PrefabInstance: {fileID: 0} 214 | m_PrefabAsset: {fileID: 0} 215 | m_GameObject: {fileID: 8067412394937766965} 216 | m_Enabled: 1 217 | serializedVersion: 3 218 | m_RenderMode: 2 219 | m_Camera: {fileID: 0} 220 | m_PlaneDistance: 100 221 | m_PixelPerfect: 0 222 | m_ReceivesEvents: 1 223 | m_OverrideSorting: 0 224 | m_OverridePixelPerfect: 0 225 | m_SortingBucketNormalizedSize: 0 226 | m_AdditionalShaderChannelsFlag: 0 227 | m_SortingLayerID: 0 228 | m_SortingOrder: 1 229 | m_TargetDisplay: 0 230 | --- !u!114 &2636598610291134728 231 | MonoBehaviour: 232 | m_ObjectHideFlags: 0 233 | m_CorrespondingSourceObject: {fileID: 0} 234 | m_PrefabInstance: {fileID: 0} 235 | m_PrefabAsset: {fileID: 0} 236 | m_GameObject: {fileID: 8067412394937766965} 237 | m_Enabled: 1 238 | m_EditorHideFlags: 0 239 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 240 | m_Name: 241 | m_EditorClassIdentifier: 242 | m_UiScaleMode: 0 243 | m_ReferencePixelsPerUnit: 100 244 | m_ScaleFactor: 1 245 | m_ReferenceResolution: {x: 800, y: 600} 246 | m_ScreenMatchMode: 0 247 | m_MatchWidthOrHeight: 0 248 | m_PhysicalUnit: 3 249 | m_FallbackScreenDPI: 96 250 | m_DefaultSpriteDPI: 96 251 | m_DynamicPixelsPerUnit: 1 252 | m_PresetInfoIsWorld: 1 253 | --- !u!114 &5500647036073789418 254 | MonoBehaviour: 255 | m_ObjectHideFlags: 0 256 | m_CorrespondingSourceObject: {fileID: 0} 257 | m_PrefabInstance: {fileID: 0} 258 | m_PrefabAsset: {fileID: 0} 259 | m_GameObject: {fileID: 8067412394937766965} 260 | m_Enabled: 1 261 | m_EditorHideFlags: 0 262 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 263 | m_Name: 264 | m_EditorClassIdentifier: 265 | m_IgnoreReversedGraphics: 1 266 | m_BlockingObjects: 0 267 | m_BlockingMask: 268 | serializedVersion: 2 269 | m_Bits: 4294967295 270 | --- !u!1 &8598289018546758909 271 | GameObject: 272 | m_ObjectHideFlags: 0 273 | m_CorrespondingSourceObject: {fileID: 0} 274 | m_PrefabInstance: {fileID: 0} 275 | m_PrefabAsset: {fileID: 0} 276 | serializedVersion: 6 277 | m_Component: 278 | - component: {fileID: 9222872215573194216} 279 | - component: {fileID: 2856161592068833040} 280 | - component: {fileID: 5970427988234876681} 281 | m_Layer: 5 282 | m_Name: Stamina 283 | m_TagString: Untagged 284 | m_Icon: {fileID: 0} 285 | m_NavMeshLayer: 0 286 | m_StaticEditorFlags: 0 287 | m_IsActive: 1 288 | --- !u!224 &9222872215573194216 289 | RectTransform: 290 | m_ObjectHideFlags: 0 291 | m_CorrespondingSourceObject: {fileID: 0} 292 | m_PrefabInstance: {fileID: 0} 293 | m_PrefabAsset: {fileID: 0} 294 | m_GameObject: {fileID: 8598289018546758909} 295 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 296 | m_LocalPosition: {x: 0, y: 0, z: 0} 297 | m_LocalScale: {x: 1, y: 1, z: 1} 298 | m_Children: [] 299 | m_Father: {fileID: 3346478602631505555} 300 | m_RootOrder: 0 301 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 302 | m_AnchorMin: {x: 0, y: 0} 303 | m_AnchorMax: {x: 1, y: 1} 304 | m_AnchoredPosition: {x: 0, y: 0.84999996} 305 | m_SizeDelta: {x: -1, y: -1.9} 306 | m_Pivot: {x: 0.5, y: 0.5} 307 | --- !u!222 &2856161592068833040 308 | CanvasRenderer: 309 | m_ObjectHideFlags: 0 310 | m_CorrespondingSourceObject: {fileID: 0} 311 | m_PrefabInstance: {fileID: 0} 312 | m_PrefabAsset: {fileID: 0} 313 | m_GameObject: {fileID: 8598289018546758909} 314 | m_CullTransparentMesh: 1 315 | --- !u!114 &5970427988234876681 316 | MonoBehaviour: 317 | m_ObjectHideFlags: 0 318 | m_CorrespondingSourceObject: {fileID: 0} 319 | m_PrefabInstance: {fileID: 0} 320 | m_PrefabAsset: {fileID: 0} 321 | m_GameObject: {fileID: 8598289018546758909} 322 | m_Enabled: 1 323 | m_EditorHideFlags: 0 324 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 325 | m_Name: 326 | m_EditorClassIdentifier: 327 | m_Material: {fileID: 0} 328 | m_Color: {r: 0.04900098, g: 1, b: 0, a: 1} 329 | m_RaycastTarget: 0 330 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 331 | m_Maskable: 1 332 | m_OnCullStateChanged: 333 | m_PersistentCalls: 334 | m_Calls: [] 335 | m_Sprite: {fileID: 7482667652216324306, guid: 5d3d271eff6593a4ca615a76854afea3, 336 | type: 3} 337 | m_Type: 3 338 | m_PreserveAspect: 0 339 | m_FillCenter: 1 340 | m_FillMethod: 0 341 | m_FillAmount: 1 342 | m_FillClockwise: 1 343 | m_FillOrigin: 0 344 | m_UseSpriteMesh: 0 345 | m_PixelsPerUnitMultiplier: 1 346 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Prefabs/Enemy.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60a87fc171af7514baae2c196a6e94f7 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Prefabs/Player.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7280635263051749940 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 3038191836722580818} 12 | - component: {fileID: 6265019015363432713} 13 | - component: {fileID: 4438415644852784319} 14 | - component: {fileID: 4348758291413134459} 15 | m_Layer: 5 16 | m_Name: CharacterUI 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 1 22 | --- !u!224 &3038191836722580818 23 | RectTransform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 7280635263051749940} 29 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 30 | m_LocalPosition: {x: 0, y: 0, z: 0} 31 | m_LocalScale: {x: 1, y: 1, z: 1} 32 | m_Children: 33 | - {fileID: 1772796137366740717} 34 | m_Father: {fileID: 7613673271373316273} 35 | m_RootOrder: 0 36 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 37 | m_AnchorMin: {x: 0, y: 0} 38 | m_AnchorMax: {x: 0, y: 0} 39 | m_AnchoredPosition: {x: 0, y: 0} 40 | m_SizeDelta: {x: 2, y: 2} 41 | m_Pivot: {x: 0.5, y: 0.5} 42 | --- !u!223 &6265019015363432713 43 | Canvas: 44 | m_ObjectHideFlags: 0 45 | m_CorrespondingSourceObject: {fileID: 0} 46 | m_PrefabInstance: {fileID: 0} 47 | m_PrefabAsset: {fileID: 0} 48 | m_GameObject: {fileID: 7280635263051749940} 49 | m_Enabled: 1 50 | serializedVersion: 3 51 | m_RenderMode: 2 52 | m_Camera: {fileID: 0} 53 | m_PlaneDistance: 100 54 | m_PixelPerfect: 0 55 | m_ReceivesEvents: 1 56 | m_OverrideSorting: 0 57 | m_OverridePixelPerfect: 0 58 | m_SortingBucketNormalizedSize: 0 59 | m_AdditionalShaderChannelsFlag: 0 60 | m_SortingLayerID: 0 61 | m_SortingOrder: 1 62 | m_TargetDisplay: 0 63 | --- !u!114 &4438415644852784319 64 | MonoBehaviour: 65 | m_ObjectHideFlags: 0 66 | m_CorrespondingSourceObject: {fileID: 0} 67 | m_PrefabInstance: {fileID: 0} 68 | m_PrefabAsset: {fileID: 0} 69 | m_GameObject: {fileID: 7280635263051749940} 70 | m_Enabled: 1 71 | m_EditorHideFlags: 0 72 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 73 | m_Name: 74 | m_EditorClassIdentifier: 75 | m_UiScaleMode: 0 76 | m_ReferencePixelsPerUnit: 100 77 | m_ScaleFactor: 1 78 | m_ReferenceResolution: {x: 800, y: 600} 79 | m_ScreenMatchMode: 0 80 | m_MatchWidthOrHeight: 0 81 | m_PhysicalUnit: 3 82 | m_FallbackScreenDPI: 96 83 | m_DefaultSpriteDPI: 96 84 | m_DynamicPixelsPerUnit: 1 85 | m_PresetInfoIsWorld: 1 86 | --- !u!114 &4348758291413134459 87 | MonoBehaviour: 88 | m_ObjectHideFlags: 0 89 | m_CorrespondingSourceObject: {fileID: 0} 90 | m_PrefabInstance: {fileID: 0} 91 | m_PrefabAsset: {fileID: 0} 92 | m_GameObject: {fileID: 7280635263051749940} 93 | m_Enabled: 1 94 | m_EditorHideFlags: 0 95 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 96 | m_Name: 97 | m_EditorClassIdentifier: 98 | m_IgnoreReversedGraphics: 1 99 | m_BlockingObjects: 0 100 | m_BlockingMask: 101 | serializedVersion: 2 102 | m_Bits: 4294967295 103 | --- !u!1 &7613673271373316278 104 | GameObject: 105 | m_ObjectHideFlags: 0 106 | m_CorrespondingSourceObject: {fileID: 0} 107 | m_PrefabInstance: {fileID: 0} 108 | m_PrefabAsset: {fileID: 0} 109 | serializedVersion: 6 110 | m_Component: 111 | - component: {fileID: 7613673271373316273} 112 | - component: {fileID: 7613673271373316272} 113 | - component: {fileID: 7613673271373316285} 114 | - component: {fileID: 7613673271373316279} 115 | - component: {fileID: 7613673271373316275} 116 | - component: {fileID: 7613673271373316284} 117 | - component: {fileID: 7613673271373316274} 118 | - component: {fileID: 4206212186048983121} 119 | m_Layer: 8 120 | m_Name: Player 121 | m_TagString: Untagged 122 | m_Icon: {fileID: 0} 123 | m_NavMeshLayer: 0 124 | m_StaticEditorFlags: 0 125 | m_IsActive: 1 126 | --- !u!4 &7613673271373316273 127 | Transform: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | m_GameObject: {fileID: 7613673271373316278} 133 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 134 | m_LocalPosition: {x: -7.51, y: -0.12, z: 0} 135 | m_LocalScale: {x: 1, y: 1, z: 1} 136 | m_Children: 137 | - {fileID: 3038191836722580818} 138 | m_Father: {fileID: 0} 139 | m_RootOrder: 0 140 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 141 | --- !u!212 &7613673271373316272 142 | SpriteRenderer: 143 | m_ObjectHideFlags: 0 144 | m_CorrespondingSourceObject: {fileID: 0} 145 | m_PrefabInstance: {fileID: 0} 146 | m_PrefabAsset: {fileID: 0} 147 | m_GameObject: {fileID: 7613673271373316278} 148 | m_Enabled: 1 149 | m_CastShadows: 0 150 | m_ReceiveShadows: 0 151 | m_DynamicOccludee: 1 152 | m_MotionVectors: 1 153 | m_LightProbeUsage: 1 154 | m_ReflectionProbeUsage: 1 155 | m_RayTracingMode: 0 156 | m_RayTraceProcedural: 0 157 | m_RenderingLayerMask: 1 158 | m_RendererPriority: 0 159 | m_Materials: 160 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 161 | m_StaticBatchInfo: 162 | firstSubMesh: 0 163 | subMeshCount: 0 164 | m_StaticBatchRoot: {fileID: 0} 165 | m_ProbeAnchor: {fileID: 0} 166 | m_LightProbeVolumeOverride: {fileID: 0} 167 | m_ScaleInLightmap: 1 168 | m_ReceiveGI: 1 169 | m_PreserveUVs: 0 170 | m_IgnoreNormalsForChartDetection: 0 171 | m_ImportantGI: 0 172 | m_StitchLightmapSeams: 1 173 | m_SelectedEditorRenderState: 0 174 | m_MinimumChartSize: 4 175 | m_AutoUVMaxDistance: 0.5 176 | m_AutoUVMaxAngle: 89 177 | m_LightmapParameters: {fileID: 0} 178 | m_SortingLayerID: 0 179 | m_SortingLayer: 0 180 | m_SortingOrder: 0 181 | m_Sprite: {fileID: 21300000, guid: 30b872bf48bddf142a2dface4eed1985, type: 3} 182 | m_Color: {r: 1, g: 1, b: 1, a: 1} 183 | m_FlipX: 0 184 | m_FlipY: 0 185 | m_DrawMode: 0 186 | m_Size: {x: 1, y: 1} 187 | m_AdaptiveModeThreshold: 0.5 188 | m_SpriteTileMode: 0 189 | m_WasSpriteAssigned: 1 190 | m_MaskInteraction: 0 191 | m_SpriteSortPoint: 0 192 | --- !u!50 &7613673271373316285 193 | Rigidbody2D: 194 | serializedVersion: 4 195 | m_ObjectHideFlags: 0 196 | m_CorrespondingSourceObject: {fileID: 0} 197 | m_PrefabInstance: {fileID: 0} 198 | m_PrefabAsset: {fileID: 0} 199 | m_GameObject: {fileID: 7613673271373316278} 200 | m_BodyType: 0 201 | m_Simulated: 1 202 | m_UseFullKinematicContacts: 0 203 | m_UseAutoMass: 0 204 | m_Mass: 1 205 | m_LinearDrag: 0 206 | m_AngularDrag: 0.05 207 | m_GravityScale: 0 208 | m_Material: {fileID: 0} 209 | m_Interpolate: 0 210 | m_SleepingMode: 1 211 | m_CollisionDetection: 0 212 | m_Constraints: 4 213 | --- !u!58 &7613673271373316279 214 | CircleCollider2D: 215 | m_ObjectHideFlags: 0 216 | m_CorrespondingSourceObject: {fileID: 0} 217 | m_PrefabInstance: {fileID: 0} 218 | m_PrefabAsset: {fileID: 0} 219 | m_GameObject: {fileID: 7613673271373316278} 220 | m_Enabled: 1 221 | m_Density: 1 222 | m_Material: {fileID: 0} 223 | m_IsTrigger: 0 224 | m_UsedByEffector: 0 225 | m_UsedByComposite: 0 226 | m_Offset: {x: 0, y: 0} 227 | serializedVersion: 2 228 | m_Radius: 0.5 229 | --- !u!114 &7613673271373316275 230 | MonoBehaviour: 231 | m_ObjectHideFlags: 0 232 | m_CorrespondingSourceObject: {fileID: 0} 233 | m_PrefabInstance: {fileID: 0} 234 | m_PrefabAsset: {fileID: 0} 235 | m_GameObject: {fileID: 7613673271373316278} 236 | m_Enabled: 1 237 | m_EditorHideFlags: 0 238 | m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} 239 | m_Name: 240 | m_EditorClassIdentifier: 241 | m_Actions: {fileID: -944628639613478452, guid: 7aab555a5183a424f800a5c606d2208e, 242 | type: 3} 243 | m_NotificationBehavior: 2 244 | m_UIInputModule: {fileID: 0} 245 | m_DeviceLostEvent: 246 | m_PersistentCalls: 247 | m_Calls: [] 248 | m_DeviceRegainedEvent: 249 | m_PersistentCalls: 250 | m_Calls: [] 251 | m_ControlsChangedEvent: 252 | m_PersistentCalls: 253 | m_Calls: [] 254 | m_ActionEvents: 255 | - m_PersistentCalls: 256 | m_Calls: 257 | - m_Target: {fileID: 7613673271373316284} 258 | m_TargetAssemblyTypeName: 259 | m_MethodName: OnMoveInput 260 | m_Mode: 0 261 | m_Arguments: 262 | m_ObjectArgument: {fileID: 0} 263 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 264 | m_IntArgument: 0 265 | m_FloatArgument: 0 266 | m_StringArgument: 267 | m_BoolArgument: 0 268 | m_CallState: 2 269 | m_ActionId: 235dd5f2-0741-461e-839f-7dbf0fda8860 270 | m_ActionName: Player/MoveControl[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d] 271 | m_NeverAutoSwitchControlSchemes: 0 272 | m_DefaultControlScheme: 273 | m_DefaultActionMap: Player 274 | m_SplitScreenIndex: -1 275 | m_Camera: {fileID: 0} 276 | --- !u!114 &7613673271373316284 277 | MonoBehaviour: 278 | m_ObjectHideFlags: 0 279 | m_CorrespondingSourceObject: {fileID: 0} 280 | m_PrefabInstance: {fileID: 0} 281 | m_PrefabAsset: {fileID: 0} 282 | m_GameObject: {fileID: 7613673271373316278} 283 | m_Enabled: 1 284 | m_EditorHideFlags: 0 285 | m_Script: {fileID: 11500000, guid: a9d14dd4301b194409417b398ae9f998, type: 3} 286 | m_Name: 287 | m_EditorClassIdentifier: 288 | --- !u!114 &7613673271373316274 289 | MonoBehaviour: 290 | m_ObjectHideFlags: 0 291 | m_CorrespondingSourceObject: {fileID: 0} 292 | m_PrefabInstance: {fileID: 0} 293 | m_PrefabAsset: {fileID: 0} 294 | m_GameObject: {fileID: 7613673271373316278} 295 | m_Enabled: 1 296 | m_EditorHideFlags: 0 297 | m_Script: {fileID: 11500000, guid: 0e764c36fb780ad408dea0bebbe5a694, type: 3} 298 | m_Name: 299 | m_EditorClassIdentifier: 300 | _stateMachine: {fileID: 11400000, guid: ecc6a3767903e9249b7db0d4fceeb7f0, type: 2} 301 | --- !u!114 &4206212186048983121 302 | MonoBehaviour: 303 | m_ObjectHideFlags: 0 304 | m_CorrespondingSourceObject: {fileID: 0} 305 | m_PrefabInstance: {fileID: 0} 306 | m_PrefabAsset: {fileID: 0} 307 | m_GameObject: {fileID: 7613673271373316278} 308 | m_Enabled: 1 309 | m_EditorHideFlags: 0 310 | m_Script: {fileID: 11500000, guid: 5c6443cccb9365040ba4e2ab785bb153, type: 3} 311 | m_Name: 312 | m_EditorClassIdentifier: 313 | _maxStamina: 10 314 | _currentStamina: 0 315 | _dropPerSecond: 1 316 | _recoverPerSecond: 2 317 | _staminaBar: {fileID: 4361919775547723046} 318 | --- !u!1 &7749667179130628487 319 | GameObject: 320 | m_ObjectHideFlags: 0 321 | m_CorrespondingSourceObject: {fileID: 0} 322 | m_PrefabInstance: {fileID: 0} 323 | m_PrefabAsset: {fileID: 0} 324 | serializedVersion: 6 325 | m_Component: 326 | - component: {fileID: 1772796137366740717} 327 | - component: {fileID: 3684293302187619150} 328 | - component: {fileID: 4361919775547723046} 329 | m_Layer: 5 330 | m_Name: Stamina 331 | m_TagString: Untagged 332 | m_Icon: {fileID: 0} 333 | m_NavMeshLayer: 0 334 | m_StaticEditorFlags: 0 335 | m_IsActive: 1 336 | --- !u!224 &1772796137366740717 337 | RectTransform: 338 | m_ObjectHideFlags: 0 339 | m_CorrespondingSourceObject: {fileID: 0} 340 | m_PrefabInstance: {fileID: 0} 341 | m_PrefabAsset: {fileID: 0} 342 | m_GameObject: {fileID: 7749667179130628487} 343 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 344 | m_LocalPosition: {x: 0, y: 0, z: 0} 345 | m_LocalScale: {x: 1, y: 1, z: 1} 346 | m_Children: [] 347 | m_Father: {fileID: 3038191836722580818} 348 | m_RootOrder: 0 349 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 350 | m_AnchorMin: {x: 0, y: 0} 351 | m_AnchorMax: {x: 1, y: 1} 352 | m_AnchoredPosition: {x: 0, y: 0.84999996} 353 | m_SizeDelta: {x: -1, y: -1.9} 354 | m_Pivot: {x: 0.5, y: 0.5} 355 | --- !u!222 &3684293302187619150 356 | CanvasRenderer: 357 | m_ObjectHideFlags: 0 358 | m_CorrespondingSourceObject: {fileID: 0} 359 | m_PrefabInstance: {fileID: 0} 360 | m_PrefabAsset: {fileID: 0} 361 | m_GameObject: {fileID: 7749667179130628487} 362 | m_CullTransparentMesh: 1 363 | --- !u!114 &4361919775547723046 364 | MonoBehaviour: 365 | m_ObjectHideFlags: 0 366 | m_CorrespondingSourceObject: {fileID: 0} 367 | m_PrefabInstance: {fileID: 0} 368 | m_PrefabAsset: {fileID: 0} 369 | m_GameObject: {fileID: 7749667179130628487} 370 | m_Enabled: 1 371 | m_EditorHideFlags: 0 372 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 373 | m_Name: 374 | m_EditorClassIdentifier: 375 | m_Material: {fileID: 0} 376 | m_Color: {r: 0.04900098, g: 1, b: 0, a: 1} 377 | m_RaycastTarget: 0 378 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 379 | m_Maskable: 1 380 | m_OnCullStateChanged: 381 | m_PersistentCalls: 382 | m_Calls: [] 383 | m_Sprite: {fileID: 7482667652216324306, guid: 5d3d271eff6593a4ca615a76854afea3, 384 | type: 3} 385 | m_Type: 3 386 | m_PreserveAspect: 0 387 | m_FillCenter: 1 388 | m_FillMethod: 0 389 | m_FillAmount: 1 390 | m_FillClockwise: 1 391 | m_FillOrigin: 0 392 | m_UseSpriteMesh: 0 393 | m_PixelsPerUnitMultiplier: 1 394 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Prefabs/Player.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 115f82fb314872a44a8b9fbf0332a7e1 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87dd7c9aaaa2e6a48b6127a0d65550dd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scenes/FollowBehaviourExample.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 1264213591} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &1138846514 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 1138846517} 135 | - component: {fileID: 1138846516} 136 | - component: {fileID: 1138846515} 137 | m_Layer: 0 138 | m_Name: Main Camera 139 | m_TagString: MainCamera 140 | m_Icon: {fileID: 0} 141 | m_NavMeshLayer: 0 142 | m_StaticEditorFlags: 0 143 | m_IsActive: 1 144 | --- !u!81 &1138846515 145 | AudioListener: 146 | m_ObjectHideFlags: 0 147 | m_CorrespondingSourceObject: {fileID: 0} 148 | m_PrefabInstance: {fileID: 0} 149 | m_PrefabAsset: {fileID: 0} 150 | m_GameObject: {fileID: 1138846514} 151 | m_Enabled: 1 152 | --- !u!20 &1138846516 153 | Camera: 154 | m_ObjectHideFlags: 0 155 | m_CorrespondingSourceObject: {fileID: 0} 156 | m_PrefabInstance: {fileID: 0} 157 | m_PrefabAsset: {fileID: 0} 158 | m_GameObject: {fileID: 1138846514} 159 | m_Enabled: 1 160 | serializedVersion: 2 161 | m_ClearFlags: 1 162 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 163 | m_projectionMatrixMode: 1 164 | m_GateFitMode: 2 165 | m_FOVAxisMode: 0 166 | m_SensorSize: {x: 36, y: 24} 167 | m_LensShift: {x: 0, y: 0} 168 | m_FocalLength: 50 169 | m_NormalizedViewPortRect: 170 | serializedVersion: 2 171 | x: 0 172 | y: 0 173 | width: 1 174 | height: 1 175 | near clip plane: 0.3 176 | far clip plane: 1000 177 | field of view: 60 178 | orthographic: 1 179 | orthographic size: 5 180 | m_Depth: -1 181 | m_CullingMask: 182 | serializedVersion: 2 183 | m_Bits: 4294967295 184 | m_RenderingPath: -1 185 | m_TargetTexture: {fileID: 0} 186 | m_TargetDisplay: 0 187 | m_TargetEye: 3 188 | m_HDR: 1 189 | m_AllowMSAA: 1 190 | m_AllowDynamicResolution: 0 191 | m_ForceIntoRT: 0 192 | m_OcclusionCulling: 1 193 | m_StereoConvergence: 10 194 | m_StereoSeparation: 0.022 195 | --- !u!4 &1138846517 196 | Transform: 197 | m_ObjectHideFlags: 0 198 | m_CorrespondingSourceObject: {fileID: 0} 199 | m_PrefabInstance: {fileID: 0} 200 | m_PrefabAsset: {fileID: 0} 201 | m_GameObject: {fileID: 1138846514} 202 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 203 | m_LocalPosition: {x: 0, y: 0, z: -10} 204 | m_LocalScale: {x: 1, y: 1, z: 1} 205 | m_Children: [] 206 | m_Father: {fileID: 0} 207 | m_RootOrder: 0 208 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 209 | --- !u!850595691 &1264213591 210 | LightingSettings: 211 | m_ObjectHideFlags: 0 212 | m_CorrespondingSourceObject: {fileID: 0} 213 | m_PrefabInstance: {fileID: 0} 214 | m_PrefabAsset: {fileID: 0} 215 | m_Name: Settings.lighting 216 | serializedVersion: 3 217 | m_GIWorkflowMode: 1 218 | m_EnableBakedLightmaps: 0 219 | m_EnableRealtimeLightmaps: 0 220 | m_RealtimeEnvironmentLighting: 1 221 | m_BounceScale: 1 222 | m_AlbedoBoost: 1 223 | m_IndirectOutputScale: 1 224 | m_UsingShadowmask: 1 225 | m_BakeBackend: 1 226 | m_LightmapMaxSize: 1024 227 | m_BakeResolution: 40 228 | m_Padding: 2 229 | m_TextureCompression: 1 230 | m_AO: 0 231 | m_AOMaxDistance: 1 232 | m_CompAOExponent: 1 233 | m_CompAOExponentDirect: 0 234 | m_ExtractAO: 0 235 | m_MixedBakeMode: 2 236 | m_LightmapsBakeMode: 1 237 | m_FilterMode: 1 238 | m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} 239 | m_ExportTrainingData: 0 240 | m_TrainingDataDestination: TrainingData 241 | m_RealtimeResolution: 2 242 | m_ForceWhiteAlbedo: 0 243 | m_ForceUpdates: 0 244 | m_FinalGather: 0 245 | m_FinalGatherRayCount: 256 246 | m_FinalGatherFiltering: 1 247 | m_PVRCulling: 1 248 | m_PVRSampling: 1 249 | m_PVRDirectSampleCount: 32 250 | m_PVRSampleCount: 512 251 | m_PVREnvironmentSampleCount: 256 252 | m_PVREnvironmentReferencePointCount: 2048 253 | m_LightProbeSampleCountMultiplier: 4 254 | m_PVRBounces: 2 255 | m_PVRMinBounces: 2 256 | m_PVREnvironmentMIS: 1 257 | m_PVRFilteringMode: 1 258 | m_PVRDenoiserTypeDirect: 1 259 | m_PVRDenoiserTypeIndirect: 1 260 | m_PVRDenoiserTypeAO: 1 261 | m_PVRFilterTypeDirect: 0 262 | m_PVRFilterTypeIndirect: 0 263 | m_PVRFilterTypeAO: 0 264 | m_PVRFilteringGaussRadiusDirect: 1 265 | m_PVRFilteringGaussRadiusIndirect: 5 266 | m_PVRFilteringGaussRadiusAO: 2 267 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 268 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 269 | m_PVRFilteringAtrousPositionSigmaAO: 1 270 | --- !u!1001 &1744324493065938150 271 | PrefabInstance: 272 | m_ObjectHideFlags: 0 273 | serializedVersion: 2 274 | m_Modification: 275 | m_TransformParent: {fileID: 0} 276 | m_Modifications: 277 | - target: {fileID: 1744324491250938977, guid: 60a87fc171af7514baae2c196a6e94f7, 278 | type: 3} 279 | propertyPath: m_Name 280 | value: Enemy 281 | objectReference: {fileID: 0} 282 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 283 | type: 3} 284 | propertyPath: m_RootOrder 285 | value: 1 286 | objectReference: {fileID: 0} 287 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 288 | type: 3} 289 | propertyPath: m_LocalPosition.x 290 | value: 7.41 291 | objectReference: {fileID: 0} 292 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 293 | type: 3} 294 | propertyPath: m_LocalPosition.y 295 | value: 0.06 296 | objectReference: {fileID: 0} 297 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 298 | type: 3} 299 | propertyPath: m_LocalPosition.z 300 | value: 0 301 | objectReference: {fileID: 0} 302 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 303 | type: 3} 304 | propertyPath: m_LocalRotation.w 305 | value: 1 306 | objectReference: {fileID: 0} 307 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 308 | type: 3} 309 | propertyPath: m_LocalRotation.x 310 | value: 0 311 | objectReference: {fileID: 0} 312 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 313 | type: 3} 314 | propertyPath: m_LocalRotation.y 315 | value: 0 316 | objectReference: {fileID: 0} 317 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 318 | type: 3} 319 | propertyPath: m_LocalRotation.z 320 | value: 0 321 | objectReference: {fileID: 0} 322 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 323 | type: 3} 324 | propertyPath: m_LocalEulerAnglesHint.x 325 | value: 0 326 | objectReference: {fileID: 0} 327 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 328 | type: 3} 329 | propertyPath: m_LocalEulerAnglesHint.y 330 | value: 0 331 | objectReference: {fileID: 0} 332 | - target: {fileID: 1744324491250938991, guid: 60a87fc171af7514baae2c196a6e94f7, 333 | type: 3} 334 | propertyPath: m_LocalEulerAnglesHint.z 335 | value: 0 336 | objectReference: {fileID: 0} 337 | m_RemovedComponents: [] 338 | m_SourcePrefab: {fileID: 100100000, guid: 60a87fc171af7514baae2c196a6e94f7, type: 3} 339 | --- !u!1001 &7613673270420976212 340 | PrefabInstance: 341 | m_ObjectHideFlags: 0 342 | serializedVersion: 2 343 | m_Modification: 344 | m_TransformParent: {fileID: 0} 345 | m_Modifications: 346 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 347 | type: 3} 348 | propertyPath: m_RootOrder 349 | value: 2 350 | objectReference: {fileID: 0} 351 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 352 | type: 3} 353 | propertyPath: m_LocalPosition.x 354 | value: -7.51 355 | objectReference: {fileID: 0} 356 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 357 | type: 3} 358 | propertyPath: m_LocalPosition.y 359 | value: -0.12 360 | objectReference: {fileID: 0} 361 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 362 | type: 3} 363 | propertyPath: m_LocalPosition.z 364 | value: 0 365 | objectReference: {fileID: 0} 366 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 367 | type: 3} 368 | propertyPath: m_LocalRotation.w 369 | value: 1 370 | objectReference: {fileID: 0} 371 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 372 | type: 3} 373 | propertyPath: m_LocalRotation.x 374 | value: 0 375 | objectReference: {fileID: 0} 376 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 377 | type: 3} 378 | propertyPath: m_LocalRotation.y 379 | value: 0 380 | objectReference: {fileID: 0} 381 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 382 | type: 3} 383 | propertyPath: m_LocalRotation.z 384 | value: 0 385 | objectReference: {fileID: 0} 386 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 387 | type: 3} 388 | propertyPath: m_LocalEulerAnglesHint.x 389 | value: 0 390 | objectReference: {fileID: 0} 391 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 392 | type: 3} 393 | propertyPath: m_LocalEulerAnglesHint.y 394 | value: 0 395 | objectReference: {fileID: 0} 396 | - target: {fileID: 7613673271373316273, guid: 115f82fb314872a44a8b9fbf0332a7e1, 397 | type: 3} 398 | propertyPath: m_LocalEulerAnglesHint.z 399 | value: 0 400 | objectReference: {fileID: 0} 401 | - target: {fileID: 7613673271373316278, guid: 115f82fb314872a44a8b9fbf0332a7e1, 402 | type: 3} 403 | propertyPath: m_Name 404 | value: Player 405 | objectReference: {fileID: 0} 406 | m_RemovedComponents: [] 407 | m_SourcePrefab: {fileID: 100100000, guid: 115f82fb314872a44a8b9fbf0332a7e1, type: 3} 408 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scenes/FollowBehaviourExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e9692fcd098f6d41b17452e2e272b5f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc0af10f0860a1d449b6688d2c025d91 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57f839679e651524a8803bf0e1a82f1f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorFollowing.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Enemy_ColorFollowing 14 | m_EditorClassIdentifier: 15 | newColor: {r: 1, g: 0.28773582, b: 0.28773582, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorFollowing.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72a864f4963e79842bae38f683c3d998 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorRecovering.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Enemy_ColorRecovering 14 | m_EditorClassIdentifier: 15 | newColor: {r: 1, g: 0.6009961, b: 0.28627455, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorRecovering.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66333bfde806b4e46a865e7894bd50a7 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorSeeking.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Enemy_ColorSeeking 14 | m_EditorClassIdentifier: 15 | newColor: {r: 1, g: 0.957369, b: 0.3726415, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_ColorSeeking.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de852beab1a0c1147a8670591e032997 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_Move.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 851fbc761c12db545ad2af62d4024720, type: 3} 13 | m_Name: Enemy_Move 14 | m_EditorClassIdentifier: 15 | speed: 0.05 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Enemy_Move.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dba1bc1ad84ad004e8e6adc7f1335197 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorNormal.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Player_ColorNormal 14 | m_EditorClassIdentifier: 15 | newColor: {r: 0.48584908, g: 0.51908505, b: 1, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorNormal.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6f2e22b8b7fc5a4d87bf0194f05a0ce 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorRecovering.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Player_ColorRecovering 14 | m_EditorClassIdentifier: 15 | newColor: {r: 0.48584908, g: 1, b: 0.9955181, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorRecovering.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 698e103a6b1bded4cb43b9f8e8d9bea8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorRunning.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3064f154a05b8b74c804dc6cbfca893c, type: 3} 13 | m_Name: Player_ColorRunning 14 | m_EditorClassIdentifier: 15 | newColor: {r: 0.48584908, g: 1, b: 0.57790875, a: 1} 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_ColorRunning.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbea5b09522059f4c8db6ab57aedba1c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_Move1.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 851fbc761c12db545ad2af62d4024720, type: 3} 13 | m_Name: Player_Move1 14 | m_EditorClassIdentifier: 15 | speed: 0.05 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_Move1.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3df1ffb3b717a941ba7089bae3d54c0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_Move2.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 851fbc761c12db545ad2af62d4024720, type: 3} 13 | m_Name: Player_Move2 14 | m_EditorClassIdentifier: 15 | speed: 0.1 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Player_Move2.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 058accb0e368d9546bf3c69db338074a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Stamina_Consume.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 81849200e4b9aaf4c986669dfb52e9cb, type: 3} 13 | m_Name: Stamina_Consume 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Stamina_Consume.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2ec5f1d484e38045bd97d52e4dce971 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Stamina_Recover.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 16b38e908cd1ec0438405364abbfdb0c, type: 3} 13 | m_Name: Stamina_Recover 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Actions/Stamina_Recover.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4429a2ecb9105c14d9c76f9756cd1d83 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02cd565dcbb828243b3b054f65d1c8b6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Enemy_FollowRadius.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4e8b7c47055b6e54abaa24980ccba0dd, type: 3} 13 | m_Name: Enemy_FollowRadius 14 | m_EditorClassIdentifier: 15 | detectionRadius: 8 16 | detectionLayer: 17 | serializedVersion: 2 18 | m_Bits: 256 19 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Enemy_FollowRadius.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c983a777d54de654a92b5404c9e00702 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Enemy_SeekRadius.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4e8b7c47055b6e54abaa24980ccba0dd, type: 3} 13 | m_Name: Enemy_SeekRadius 14 | m_EditorClassIdentifier: 15 | detectionRadius: 6 16 | detectionLayer: 17 | serializedVersion: 2 18 | m_Bits: 256 19 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Enemy_SeekRadius.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c109c61b6c60e7a4b8cbe9515bfbdc70 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Input_Run.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd68f914f3575334491596c6f28c319a, type: 3} 13 | m_Name: Input_Run 14 | m_EditorClassIdentifier: 15 | inputActionAsset: {fileID: -944628639613478452, guid: 7aab555a5183a424f800a5c606d2208e, 16 | type: 3} 17 | actionName: Run 18 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Input_Run.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2016e035ffebea04da024abcc9fcafb6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Stamina_Depleted.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 87907bcd0a0f0684a8dad98d19a4ef7e, type: 3} 13 | m_Name: Stamina_Depleted 14 | m_EditorClassIdentifier: 15 | checkStatus: 0 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Stamina_Depleted.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ba8d06b8e49764469ed3c86c9df6a5c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Stamina_Full.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 87907bcd0a0f0684a8dad98d19a4ef7e, type: 3} 13 | m_Name: Stamina_Full 14 | m_EditorClassIdentifier: 15 | checkStatus: 2 16 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/Conditions/Stamina_Full.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52f4eeafa42d60a42ac8f605a2c4f475 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/StateMachines.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1da6d9a99e1b3e1499a850dc0337e26f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/StateMachines/EnemyStateMachine.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 718ecb92f024ea14e8d2f2450ca5def2, type: 3} 13 | m_Name: EnemyStateMachine 14 | m_EditorClassIdentifier: 15 | _initialState: {fileID: 11400000, guid: c14b5c563e9b00941a43ba5fff0250ef, type: 2} 16 | _emptyState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 17 | _transitions: 18 | - originState: {fileID: 11400000, guid: c14b5c563e9b00941a43ba5fff0250ef, type: 2} 19 | condition: {fileID: 11400000, guid: c109c61b6c60e7a4b8cbe9515bfbdc70, type: 2} 20 | trueState: {fileID: 11400000, guid: fb778ba37ab1f084a8805807dbbbd976, type: 2} 21 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 22 | - originState: {fileID: 11400000, guid: fb778ba37ab1f084a8805807dbbbd976, type: 2} 23 | condition: {fileID: 11400000, guid: c983a777d54de654a92b5404c9e00702, type: 2} 24 | trueState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 25 | falseState: {fileID: 11400000, guid: c14b5c563e9b00941a43ba5fff0250ef, type: 2} 26 | - originState: {fileID: 11400000, guid: fb778ba37ab1f084a8805807dbbbd976, type: 2} 27 | condition: {fileID: 11400000, guid: 2ba8d06b8e49764469ed3c86c9df6a5c, type: 2} 28 | trueState: {fileID: 11400000, guid: 558048e037c71724684d890d5aa22da7, type: 2} 29 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 30 | - originState: {fileID: 11400000, guid: 558048e037c71724684d890d5aa22da7, type: 2} 31 | condition: {fileID: 11400000, guid: 52f4eeafa42d60a42ac8f605a2c4f475, type: 2} 32 | trueState: {fileID: 11400000, guid: c14b5c563e9b00941a43ba5fff0250ef, type: 2} 33 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 34 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/StateMachines/EnemyStateMachine.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddefda1cc53ccf848bbf505cce7fe01e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/StateMachines/PlayerStateMachine.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 718ecb92f024ea14e8d2f2450ca5def2, type: 3} 13 | m_Name: PlayerStateMachine 14 | m_EditorClassIdentifier: 15 | _initialState: {fileID: 11400000, guid: 592d9bb1b3522924994190930aa8242c, type: 2} 16 | _emptyState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 17 | _transitions: 18 | - originState: {fileID: 11400000, guid: 592d9bb1b3522924994190930aa8242c, type: 2} 19 | condition: {fileID: 11400000, guid: 2016e035ffebea04da024abcc9fcafb6, type: 2} 20 | trueState: {fileID: 11400000, guid: bcb554ff504b7ab409453ac19e3eb5ae, type: 2} 21 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 22 | - originState: {fileID: 11400000, guid: bcb554ff504b7ab409453ac19e3eb5ae, type: 2} 23 | condition: {fileID: 11400000, guid: 2016e035ffebea04da024abcc9fcafb6, type: 2} 24 | trueState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 25 | falseState: {fileID: 11400000, guid: 592d9bb1b3522924994190930aa8242c, type: 2} 26 | - originState: {fileID: 11400000, guid: bcb554ff504b7ab409453ac19e3eb5ae, type: 2} 27 | condition: {fileID: 11400000, guid: 2ba8d06b8e49764469ed3c86c9df6a5c, type: 2} 28 | trueState: {fileID: 11400000, guid: 4de5b6602d6af1a4c956be67725f0633, type: 2} 29 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 30 | - originState: {fileID: 11400000, guid: 4de5b6602d6af1a4c956be67725f0633, type: 2} 31 | condition: {fileID: 11400000, guid: 52f4eeafa42d60a42ac8f605a2c4f475, type: 2} 32 | trueState: {fileID: 11400000, guid: 592d9bb1b3522924994190930aa8242c, type: 2} 33 | falseState: {fileID: 11400000, guid: 20352fc7a011e8748b8ba85265763ede, type: 2} 34 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/StateMachines/PlayerStateMachine.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecc6a3767903e9249b7db0d4fceeb7f0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe58b3b9fb2a16e4a8acf31c8be0e9fe 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Following.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Enemy_Following 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: 72a864f4963e79842bae38f683c3d998, type: 2} 17 | _exitActions: [] 18 | _physicsActions: 19 | - {fileID: 11400000, guid: dba1bc1ad84ad004e8e6adc7f1335197, type: 2} 20 | _stateActions: 21 | - {fileID: 11400000, guid: d2ec5f1d484e38045bd97d52e4dce971, type: 2} 22 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Following.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb778ba37ab1f084a8805807dbbbd976 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Recovering.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Enemy_Recovering 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: 66333bfde806b4e46a865e7894bd50a7, type: 2} 17 | _exitActions: [] 18 | _physicsActions: [] 19 | _stateActions: 20 | - {fileID: 11400000, guid: 4429a2ecb9105c14d9c76f9756cd1d83, type: 2} 21 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Recovering.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 558048e037c71724684d890d5aa22da7 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Seeking.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Enemy_Seeking 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: de852beab1a0c1147a8670591e032997, type: 2} 17 | _exitActions: [] 18 | _physicsActions: [] 19 | _stateActions: [] 20 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Enemy_Seeking.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c14b5c563e9b00941a43ba5fff0250ef 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Normal.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Player_Normal 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: e6f2e22b8b7fc5a4d87bf0194f05a0ce, type: 2} 17 | _exitActions: [] 18 | _physicsActions: 19 | - {fileID: 11400000, guid: c3df1ffb3b717a941ba7089bae3d54c0, type: 2} 20 | _stateActions: 21 | - {fileID: 11400000, guid: 4429a2ecb9105c14d9c76f9756cd1d83, type: 2} 22 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Normal.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 592d9bb1b3522924994190930aa8242c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Recovering.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Player_Recovering 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: 698e103a6b1bded4cb43b9f8e8d9bea8, type: 2} 17 | _exitActions: [] 18 | _physicsActions: [] 19 | _stateActions: 20 | - {fileID: 11400000, guid: 4429a2ecb9105c14d9c76f9756cd1d83, type: 2} 21 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Recovering.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4de5b6602d6af1a4c956be67725f0633 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Running.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 499f9dc307232184ca30934e3fc72ee2, type: 3} 13 | m_Name: Player_Running 14 | m_EditorClassIdentifier: 15 | _entryActions: 16 | - {fileID: 11400000, guid: bbea5b09522059f4c8db6ab57aedba1c, type: 2} 17 | _exitActions: [] 18 | _physicsActions: 19 | - {fileID: 11400000, guid: 058accb0e368d9546bf3c69db338074a, type: 2} 20 | _stateActions: 21 | - {fileID: 11400000, guid: d2ec5f1d484e38045bd97d52e4dce971, type: 2} 22 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/ScriptableAssets/States/Player_Running.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcb554ff504b7ab409453ac19e3eb5ae 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf001910971558b4186a88b150d3583e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f0e539ac405fca4db0feabaa072d8f1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/ChangeSpriteColorAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/ChangeSpriteColorAction", fileName = "new ChangeSpriteColorAction")] 7 | public class ChangeSpriteColorAction : ScriptableAction 8 | { 9 | public Color newColor = Color.white; 10 | 11 | public override void Act(StateComponent statesComponent) 12 | { 13 | statesComponent.GetComponent().color = newColor; 14 | } 15 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/ChangeSpriteColorAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3064f154a05b8b74c804dc6cbfca893c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/ConsumeStaminaAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/ConsumeStaminaAction", fileName = "new ConsumeStaminaAction")] 7 | public class ConsumeStaminaAction : ScriptableAction 8 | { 9 | public override void Act(StateComponent statesComponent) 10 | { 11 | statesComponent.GetComponent().ConsumeStamina(); 12 | } 13 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/ConsumeStaminaAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81849200e4b9aaf4c986669dfb52e9cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/MovementAction.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using loophouse.ScriptableStates; 3 | 4 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/MovementAction", fileName = "new MovementAction")] 5 | public class MovementAction : ScriptableAction 6 | { 7 | public float speed; 8 | public override void Act(StateComponent statesComponent) 9 | { 10 | statesComponent.GetComponent().Move(speed); 11 | } 12 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/MovementAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 851fbc761c12db545ad2af62d4024720 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/RecoverStaminaAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/RecoverStaminaAction", fileName = "new RecoverStaminaAction")] 7 | public class RecoverStaminaAction : ScriptableAction 8 | { 9 | public override void Act(StateComponent statesComponent) 10 | { 11 | statesComponent.GetComponent().RecoverStamina(); 12 | } 13 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Actions/RecoverStaminaAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16b38e908cd1ec0438405364abbfdb0c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4402113d8c449374e85bf1f306f4c835 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/EnemyComponent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class EnemyComponent : MonoBehaviour, IMovable 4 | { 5 | private Transform _target; 6 | private Rigidbody2D _rigidbody2D; 7 | 8 | 9 | private void Start() 10 | { 11 | _rigidbody2D = GetComponent(); 12 | } 13 | 14 | public void Move(float speed) 15 | { 16 | _rigidbody2D.MovePosition(Vector2.MoveTowards(_rigidbody2D.position, _target.position, speed)); 17 | } 18 | 19 | public void SetTarget(Transform target) 20 | { 21 | _target = target; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/EnemyComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f3772f071b62cc428a1e0581acfa7a5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/PlayerComponent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.InputSystem; 3 | 4 | public class PlayerComponent : MonoBehaviour, IMovable 5 | { 6 | private Rigidbody2D _rigidbody2D; 7 | private Vector2 _direction; 8 | 9 | private void Start() 10 | { 11 | _rigidbody2D = GetComponent(); 12 | } 13 | 14 | public void OnMoveInput(InputAction.CallbackContext context) 15 | { 16 | if (context.performed) 17 | { 18 | _direction = context.ReadValue(); 19 | } 20 | else 21 | { 22 | _direction = Vector2.zero; 23 | } 24 | } 25 | 26 | public void Move(float speed) 27 | { 28 | _rigidbody2D.MovePosition(Vector2.MoveTowards(_rigidbody2D.position, _rigidbody2D.position + _direction, speed)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/PlayerComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9d14dd4301b194409417b398ae9f998 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/StaminaComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class StaminaComponent : MonoBehaviour 7 | { 8 | [SerializeField] private int _maxStamina; 9 | [SerializeField] private int _currentStamina; 10 | [SerializeField] private int _dropPerSecond; 11 | [SerializeField] private int _recoverPerSecond; 12 | [SerializeField] private Image _staminaBar; 13 | private float timer; 14 | 15 | public int MaxStamina { get => _maxStamina; } 16 | public int CurrentStamina { get => _currentStamina; } 17 | 18 | void Start() 19 | { 20 | _currentStamina = _maxStamina; 21 | UpdateStaminaBar(); 22 | } 23 | 24 | public StaminaStatus GetStaminaStatus() 25 | { 26 | if (_currentStamina == 0) 27 | { 28 | return StaminaStatus.DEPLETED; 29 | } 30 | else if (_currentStamina == _maxStamina) 31 | { 32 | return StaminaStatus.FULL; 33 | } 34 | else 35 | { 36 | return StaminaStatus.IN_USE; 37 | } 38 | } 39 | 40 | public void ConsumeStamina() 41 | { 42 | timer += Time.deltaTime; 43 | if (timer >= 1) 44 | { 45 | if (_currentStamina > 0) 46 | { 47 | if (_currentStamina < _dropPerSecond) 48 | { 49 | _currentStamina = 0; 50 | } 51 | else 52 | { 53 | _currentStamina -= _dropPerSecond; 54 | } 55 | } 56 | timer = 0; 57 | UpdateStaminaBar(); 58 | } 59 | } 60 | 61 | public void RecoverStamina() 62 | { 63 | timer += Time.deltaTime; 64 | if (timer >= 1) 65 | { 66 | if (_currentStamina < _maxStamina) 67 | { 68 | if (_currentStamina + _recoverPerSecond > _maxStamina) 69 | { 70 | _currentStamina = _maxStamina; 71 | } 72 | else 73 | { 74 | _currentStamina += _recoverPerSecond; 75 | } 76 | } 77 | timer = 0; 78 | UpdateStaminaBar(); 79 | } 80 | } 81 | 82 | private void UpdateStaminaBar() 83 | { 84 | _staminaBar.fillAmount = ((float)_currentStamina / (float)_maxStamina); 85 | } 86 | } 87 | 88 | public enum StaminaStatus { DEPLETED, IN_USE, FULL } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Components/StaminaComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c6443cccb9365040ba4e2ab785bb153 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d30e99c99156afd4483e2acbaac5ba58 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/InputCondition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | using UnityEngine.InputSystem; 6 | using UnityEngine.InputSystem.Controls; 7 | 8 | [CreateAssetMenu(menuName = "Scriptable State Machine/Conditions/InputCondition", fileName = "new InputCondition")] 9 | public class InputCondition : ScriptableCondition 10 | { 11 | public InputActionAsset inputActionAsset; 12 | public string actionName; 13 | private InputAction _inputAction; 14 | ButtonControl _button; 15 | 16 | private void OnEnable() 17 | { 18 | _inputAction = inputActionAsset.FindAction(actionName); 19 | } 20 | 21 | public override bool Verify(StateComponent statesComponent) 22 | { 23 | _button = _inputAction.activeControl as ButtonControl; 24 | if (_button != null) 25 | { 26 | return _button.isPressed; 27 | } 28 | 29 | return false; 30 | } 31 | 32 | 33 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/InputCondition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd68f914f3575334491596c6f28c319a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/RadialTargetDetectionCondition.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using loophouse.ScriptableStates; 3 | 4 | [CreateAssetMenu(menuName = "Scriptable State Machine/Conditions/RadialTargetDetectionCondition", fileName = "new RadialTargetDetectionCondition")] 5 | public class RadialTargetDetectionCondition : ScriptableCondition 6 | { 7 | public float detectionRadius; 8 | public LayerMask detectionLayer; 9 | 10 | public override bool Verify(StateComponent smComponent) 11 | { 12 | Vector2 position = smComponent.transform.position; 13 | Transform target = Physics2D.OverlapCircle(position, detectionRadius, detectionLayer)?.transform; 14 | 15 | EnemyComponent component = smComponent.GetComponent(); 16 | if (component) 17 | { 18 | component.SetTarget(target); 19 | } 20 | 21 | return target != null; 22 | } 23 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/RadialTargetDetectionCondition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e8b7c47055b6e54abaa24980ccba0dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/StaminaCheckCondition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Conditions/StaminaCheckCondition", fileName = "new StaminaCheckCondition")] 7 | public class StaminaCheckCondition : ScriptableCondition 8 | { 9 | public StaminaStatus checkStatus; 10 | 11 | public override bool Verify(StateComponent statesComponent) 12 | { 13 | return checkStatus == statesComponent.GetComponent().GetStaminaStatus(); 14 | } 15 | } -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Conditions/StaminaCheckCondition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87907bcd0a0f0684a8dad98d19a4ef7e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0164e5ddec0e5d14e84565694c2d4f35 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Interfaces/IMovable.cs: -------------------------------------------------------------------------------- 1 | public interface IMovable 2 | { 3 | void Move(float speed); 4 | } 5 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Scripts/Interfaces/IMovable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e038282c0fd689a40bc6fc90fda9984c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78ddf878983e19b469b97715b24dd2f9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Enemy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisoliveiras/scriptable-states/98c4b2c5269a98c7585b424414bc681fa20e31a9/Samples~/FollowBehaviourExample/Sprites/Enemy.png -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Enemy.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30e08f7c73558ea4b9be14e39fb55d86 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 0 36 | aniso: 1 37 | mipBias: 0 38 | wrapU: 0 39 | wrapV: 0 40 | wrapW: 0 41 | nPOTScale: 0 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 3 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 4 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 0 54 | spriteTessellationDetail: -1 55 | textureType: 8 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | flipbookRows: 1 59 | flipbookColumns: 1 60 | maxTextureSizeSet: 0 61 | compressionQualitySet: 0 62 | textureFormatSet: 0 63 | ignorePngGamma: 0 64 | applyGammaDecoding: 0 65 | platformSettings: 66 | - serializedVersion: 3 67 | buildTarget: DefaultTexturePlatform 68 | maxTextureSize: 2048 69 | resizeAlgorithm: 0 70 | textureFormat: 4 71 | textureCompression: 1 72 | compressionQuality: 50 73 | crunchedCompression: 0 74 | allowsAlphaSplitting: 0 75 | overridden: 0 76 | androidETC2FallbackOverride: 0 77 | forceMaximumCompressionQuality_BC6H_BC7: 0 78 | spriteSheet: 79 | serializedVersion: 2 80 | sprites: [] 81 | outline: 82 | - - {x: 0, y: 2} 83 | - {x: -0.09813535, y: 1.9975909} 84 | - {x: -0.19603428, y: 1.9903694} 85 | - {x: -0.29346094, y: 1.978353} 86 | - {x: -0.39018065, y: 1.9615705} 87 | - {x: -0.4859604, y: 1.9400625} 88 | - {x: -0.5805693, y: 1.9138807} 89 | - {x: -0.67377967, y: 1.8830881} 90 | - {x: -0.76536685, y: 1.8477591} 91 | - {x: -0.8551101, y: 1.8079786} 92 | - {x: -0.9427934, y: 1.7638426} 93 | - {x: -1.0282055, y: 1.7154572} 94 | - {x: -1.1111405, y: 1.6629392} 95 | - {x: -1.1913986, y: 1.606415} 96 | - {x: -1.2687867, y: 1.5460209} 97 | - {x: -1.343118, y: 1.4819021} 98 | - {x: -1.4142137, y: 1.4142134} 99 | - {x: -1.4819024, y: 1.3431177} 100 | - {x: -1.5460211, y: 1.2687864} 101 | - {x: -1.6064153, y: 1.1913984} 102 | - {x: -1.6629394, y: 1.1111403} 103 | - {x: -1.7154574, y: 1.0282052} 104 | - {x: -1.7638427, y: 0.94279313} 105 | - {x: -1.8079787, y: 0.8551098} 106 | - {x: -1.8477592, y: 0.76536644} 107 | - {x: -1.8830884, y: 0.6737792} 108 | - {x: -1.9138808, y: 0.5805688} 109 | - {x: -1.9400626, y: 0.48595977} 110 | - {x: -1.9615707, y: 0.39018002} 111 | - {x: -1.9783531, y: 0.29346028} 112 | - {x: -1.9903696, y: 0.19603357} 113 | - {x: -1.9975909, y: 0.098134585} 114 | - {x: -2, y: -0.0000008026785} 115 | - {x: -1.9975909, y: -0.09813619} 116 | - {x: -1.9903693, y: -0.19603516} 117 | - {x: -1.9783529, y: -0.29346186} 118 | - {x: -1.9615704, y: -0.3901816} 119 | - {x: -1.9400623, y: -0.48596132} 120 | - {x: -1.9138803, y: -0.58057034} 121 | - {x: -1.8830878, y: -0.67378074} 122 | - {x: -1.8477587, y: -0.7653679} 123 | - {x: -1.8079782, y: -0.855111} 124 | - {x: -1.7638422, y: -0.9427941} 125 | - {x: -1.715457, y: -1.028206} 126 | - {x: -1.6629391, y: -1.1111407} 127 | - {x: -1.606415, y: -1.1913987} 128 | - {x: -1.546021, y: -1.2687865} 129 | - {x: -1.4819025, y: -1.3431177} 130 | - {x: -1.4142139, y: -1.4142132} 131 | - {x: -1.3431184, y: -1.4819018} 132 | - {x: -1.2687873, y: -1.5460204} 133 | - {x: -1.1913995, y: -1.6064144} 134 | - {x: -1.1111416, y: -1.6629385} 135 | - {x: -1.0282067, y: -1.7154565} 136 | - {x: -0.9427949, y: -1.7638417} 137 | - {x: -0.85511184, y: -1.8079778} 138 | - {x: -0.76536876, y: -1.8477583} 139 | - {x: -0.6737818, y: -1.8830874} 140 | - {x: -0.5805717, y: -1.91388} 141 | - {x: -0.48596293, y: -1.9400618} 142 | - {x: -0.39018345, y: -1.96157} 143 | - {x: -0.29346398, y: -1.9783525} 144 | - {x: -0.1960375, y: -1.9903691} 145 | - {x: -0.09813879, y: -1.9975908} 146 | - {x: -0.0000036398517, y: -2} 147 | - {x: 0.098131515, y: -1.9975911} 148 | - {x: 0.19603026, y: -1.9903698} 149 | - {x: 0.29345676, y: -1.9783536} 150 | - {x: 0.3901763, y: -1.9615715} 151 | - {x: 0.48595586, y: -1.9400636} 152 | - {x: 0.58056474, y: -1.913882} 153 | - {x: 0.67377496, y: -1.8830898} 154 | - {x: 0.765362, y: -1.847761} 155 | - {x: 0.8551053, y: -1.8079809} 156 | - {x: 0.94278854, y: -1.7638452} 157 | - {x: 1.0282005, y: -1.7154602} 158 | - {x: 1.1111355, y: -1.6629425} 159 | - {x: 1.1913936, y: -1.6064187} 160 | - {x: 1.2687817, y: -1.5460249} 161 | - {x: 1.3431131, y: -1.4819067} 162 | - {x: 1.4142088, y: -1.4142184} 163 | - {x: 1.4818976, y: -1.3431231} 164 | - {x: 1.5460167, y: -1.2687918} 165 | - {x: 1.6064112, y: -1.1914037} 166 | - {x: 1.6629357, y: -1.1111456} 167 | - {x: 1.7154542, y: -1.0282105} 168 | - {x: 1.7638398, y: -0.94279844} 169 | - {x: 1.8079762, y: -0.855115} 170 | - {x: 1.8477571, y: -0.76537156} 171 | - {x: 1.8830866, y: -0.6737842} 172 | - {x: 1.9138794, y: -0.5805737} 173 | - {x: 1.9400615, y: -0.48596448} 174 | - {x: 1.9615698, y: -0.39018452} 175 | - {x: 1.9783524, y: -0.29346457} 176 | - {x: 1.9903691, y: -0.19603767} 177 | - {x: 1.9975908, y: -0.09813846} 178 | - {x: 2, y: -0.0000028371733} 179 | - {x: 1.997591, y: 0.0981328} 180 | - {x: 1.9903697, y: 0.19603202} 181 | - {x: 1.9783533, y: 0.29345897} 182 | - {x: 1.9615709, y: 0.39017895} 183 | - {x: 1.9400629, y: 0.48595896} 184 | - {x: 1.9138811, y: 0.58056825} 185 | - {x: 1.8830885, y: 0.6737789} 186 | - {x: 1.8477592, y: 0.7653663} 187 | - {x: 1.8079787, y: 0.8551099} 188 | - {x: 1.7638426, y: 0.9427934} 189 | - {x: 1.7154571, y: 1.0282056} 190 | - {x: 1.662939, y: 1.1111408} 191 | - {x: 1.6064146, y: 1.1913992} 192 | - {x: 1.5460203, y: 1.2687874} 193 | - {x: 1.4819014, y: 1.3431189} 194 | - {x: 1.4142125, y: 1.4142147} 195 | - {x: 1.3431165, y: 1.4819036} 196 | - {x: 1.2687849, y: 1.5460223} 197 | - {x: 1.1913966, y: 1.6064166} 198 | - {x: 1.1111382, y: 1.6629407} 199 | - {x: 1.0282029, y: 1.7154588} 200 | - {x: 0.94279057, y: 1.7638441} 201 | - {x: 0.85510695, y: 1.8079801} 202 | - {x: 0.76536334, y: 1.8477606} 203 | - {x: 0.67377585, y: 1.8830895} 204 | - {x: 0.58056515, y: 1.9138819} 205 | - {x: 0.48595583, y: 1.9400636} 206 | - {x: 0.3901758, y: 1.9615716} 207 | - {x: 0.29345578, y: 1.9783537} 208 | - {x: 0.1960288, y: 1.99037} 209 | - {x: 0.09812956, y: 1.9975911} 210 | physicsShape: 211 | - - {x: 0, y: 2} 212 | - {x: -0.09813535, y: 1.9975909} 213 | - {x: -0.19603428, y: 1.9903694} 214 | - {x: -0.29346094, y: 1.978353} 215 | - {x: -0.39018065, y: 1.9615705} 216 | - {x: -0.4859604, y: 1.9400625} 217 | - {x: -0.5805693, y: 1.9138807} 218 | - {x: -0.67377967, y: 1.8830881} 219 | - {x: -0.76536685, y: 1.8477591} 220 | - {x: -0.8551101, y: 1.8079786} 221 | - {x: -0.9427934, y: 1.7638426} 222 | - {x: -1.0282055, y: 1.7154572} 223 | - {x: -1.1111405, y: 1.6629392} 224 | - {x: -1.1913986, y: 1.606415} 225 | - {x: -1.2687867, y: 1.5460209} 226 | - {x: -1.343118, y: 1.4819021} 227 | - {x: -1.4142137, y: 1.4142134} 228 | - {x: -1.4819024, y: 1.3431177} 229 | - {x: -1.5460211, y: 1.2687864} 230 | - {x: -1.6064153, y: 1.1913984} 231 | - {x: -1.6629394, y: 1.1111403} 232 | - {x: -1.7154574, y: 1.0282052} 233 | - {x: -1.7638427, y: 0.94279313} 234 | - {x: -1.8079787, y: 0.8551098} 235 | - {x: -1.8477592, y: 0.76536644} 236 | - {x: -1.8830884, y: 0.6737792} 237 | - {x: -1.9138808, y: 0.5805688} 238 | - {x: -1.9400626, y: 0.48595977} 239 | - {x: -1.9615707, y: 0.39018002} 240 | - {x: -1.9783531, y: 0.29346028} 241 | - {x: -1.9903696, y: 0.19603357} 242 | - {x: -1.9975909, y: 0.098134585} 243 | - {x: -2, y: -0.0000008026785} 244 | - {x: -1.9975909, y: -0.09813619} 245 | - {x: -1.9903693, y: -0.19603516} 246 | - {x: -1.9783529, y: -0.29346186} 247 | - {x: -1.9615704, y: -0.3901816} 248 | - {x: -1.9400623, y: -0.48596132} 249 | - {x: -1.9138803, y: -0.58057034} 250 | - {x: -1.8830878, y: -0.67378074} 251 | - {x: -1.8477587, y: -0.7653679} 252 | - {x: -1.8079782, y: -0.855111} 253 | - {x: -1.7638422, y: -0.9427941} 254 | - {x: -1.715457, y: -1.028206} 255 | - {x: -1.6629391, y: -1.1111407} 256 | - {x: -1.606415, y: -1.1913987} 257 | - {x: -1.546021, y: -1.2687865} 258 | - {x: -1.4819025, y: -1.3431177} 259 | - {x: -1.4142139, y: -1.4142132} 260 | - {x: -1.3431184, y: -1.4819018} 261 | - {x: -1.2687873, y: -1.5460204} 262 | - {x: -1.1913995, y: -1.6064144} 263 | - {x: -1.1111416, y: -1.6629385} 264 | - {x: -1.0282067, y: -1.7154565} 265 | - {x: -0.9427949, y: -1.7638417} 266 | - {x: -0.85511184, y: -1.8079778} 267 | - {x: -0.76536876, y: -1.8477583} 268 | - {x: -0.6737818, y: -1.8830874} 269 | - {x: -0.5805717, y: -1.91388} 270 | - {x: -0.48596293, y: -1.9400618} 271 | - {x: -0.39018345, y: -1.96157} 272 | - {x: -0.29346398, y: -1.9783525} 273 | - {x: -0.1960375, y: -1.9903691} 274 | - {x: -0.09813879, y: -1.9975908} 275 | - {x: -0.0000036398517, y: -2} 276 | - {x: 0.098131515, y: -1.9975911} 277 | - {x: 0.19603026, y: -1.9903698} 278 | - {x: 0.29345676, y: -1.9783536} 279 | - {x: 0.3901763, y: -1.9615715} 280 | - {x: 0.48595586, y: -1.9400636} 281 | - {x: 0.58056474, y: -1.913882} 282 | - {x: 0.67377496, y: -1.8830898} 283 | - {x: 0.765362, y: -1.847761} 284 | - {x: 0.8551053, y: -1.8079809} 285 | - {x: 0.94278854, y: -1.7638452} 286 | - {x: 1.0282005, y: -1.7154602} 287 | - {x: 1.1111355, y: -1.6629425} 288 | - {x: 1.1913936, y: -1.6064187} 289 | - {x: 1.2687817, y: -1.5460249} 290 | - {x: 1.3431131, y: -1.4819067} 291 | - {x: 1.4142088, y: -1.4142184} 292 | - {x: 1.4818976, y: -1.3431231} 293 | - {x: 1.5460167, y: -1.2687918} 294 | - {x: 1.6064112, y: -1.1914037} 295 | - {x: 1.6629357, y: -1.1111456} 296 | - {x: 1.7154542, y: -1.0282105} 297 | - {x: 1.7638398, y: -0.94279844} 298 | - {x: 1.8079762, y: -0.855115} 299 | - {x: 1.8477571, y: -0.76537156} 300 | - {x: 1.8830866, y: -0.6737842} 301 | - {x: 1.9138794, y: -0.5805737} 302 | - {x: 1.9400615, y: -0.48596448} 303 | - {x: 1.9615698, y: -0.39018452} 304 | - {x: 1.9783524, y: -0.29346457} 305 | - {x: 1.9903691, y: -0.19603767} 306 | - {x: 1.9975908, y: -0.09813846} 307 | - {x: 2, y: -0.0000028371733} 308 | - {x: 1.997591, y: 0.0981328} 309 | - {x: 1.9903697, y: 0.19603202} 310 | - {x: 1.9783533, y: 0.29345897} 311 | - {x: 1.9615709, y: 0.39017895} 312 | - {x: 1.9400629, y: 0.48595896} 313 | - {x: 1.9138811, y: 0.58056825} 314 | - {x: 1.8830885, y: 0.6737789} 315 | - {x: 1.8477592, y: 0.7653663} 316 | - {x: 1.8079787, y: 0.8551099} 317 | - {x: 1.7638426, y: 0.9427934} 318 | - {x: 1.7154571, y: 1.0282056} 319 | - {x: 1.662939, y: 1.1111408} 320 | - {x: 1.6064146, y: 1.1913992} 321 | - {x: 1.5460203, y: 1.2687874} 322 | - {x: 1.4819014, y: 1.3431189} 323 | - {x: 1.4142125, y: 1.4142147} 324 | - {x: 1.3431165, y: 1.4819036} 325 | - {x: 1.2687849, y: 1.5460223} 326 | - {x: 1.1913966, y: 1.6064166} 327 | - {x: 1.1111382, y: 1.6629407} 328 | - {x: 1.0282029, y: 1.7154588} 329 | - {x: 0.94279057, y: 1.7638441} 330 | - {x: 0.85510695, y: 1.8079801} 331 | - {x: 0.76536334, y: 1.8477606} 332 | - {x: 0.67377585, y: 1.8830895} 333 | - {x: 0.58056515, y: 1.9138819} 334 | - {x: 0.48595583, y: 1.9400636} 335 | - {x: 0.3901758, y: 1.9615716} 336 | - {x: 0.29345578, y: 1.9783537} 337 | - {x: 0.1960288, y: 1.99037} 338 | - {x: 0.09812956, y: 1.9975911} 339 | bones: [] 340 | spriteID: 5e97eb03825dee720800000000000000 341 | internalID: 0 342 | vertices: [] 343 | indices: 344 | edges: [] 345 | weights: [] 346 | secondaryTextures: [] 347 | spritePackingTag: 348 | pSDRemoveMatte: 0 349 | pSDShowRemoveMatteOption: 0 350 | userData: 351 | assetBundleName: 352 | assetBundleVariant: 353 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisoliveiras/scriptable-states/98c4b2c5269a98c7585b424414bc681fa20e31a9/Samples~/FollowBehaviourExample/Sprites/Player.png -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Player.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30b872bf48bddf142a2dface4eed1985 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 0 36 | aniso: 1 37 | mipBias: 0 38 | wrapU: 0 39 | wrapV: 0 40 | wrapW: 0 41 | nPOTScale: 0 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 3 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 4 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 0 54 | spriteTessellationDetail: -1 55 | textureType: 8 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | flipbookRows: 1 59 | flipbookColumns: 1 60 | maxTextureSizeSet: 0 61 | compressionQualitySet: 0 62 | textureFormatSet: 0 63 | ignorePngGamma: 0 64 | applyGammaDecoding: 0 65 | platformSettings: 66 | - serializedVersion: 3 67 | buildTarget: DefaultTexturePlatform 68 | maxTextureSize: 2048 69 | resizeAlgorithm: 0 70 | textureFormat: 4 71 | textureCompression: 1 72 | compressionQuality: 50 73 | crunchedCompression: 0 74 | allowsAlphaSplitting: 0 75 | overridden: 0 76 | androidETC2FallbackOverride: 0 77 | forceMaximumCompressionQuality_BC6H_BC7: 0 78 | spriteSheet: 79 | serializedVersion: 2 80 | sprites: [] 81 | outline: 82 | - - {x: 0, y: 2} 83 | - {x: -1.7320508, y: -1.0000001} 84 | - {x: 1.7320509, y: -0.9999998} 85 | physicsShape: 86 | - - {x: 0, y: 2} 87 | - {x: -1.7320508, y: -1.0000001} 88 | - {x: 1.7320509, y: -0.9999998} 89 | bones: [] 90 | spriteID: 5e97eb03825dee720800000000000000 91 | internalID: 0 92 | vertices: [] 93 | indices: 94 | edges: [] 95 | weights: [] 96 | secondaryTextures: [] 97 | spritePackingTag: 98 | pSDRemoveMatte: 0 99 | pSDShowRemoveMatteOption: 0 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisoliveiras/scriptable-states/98c4b2c5269a98c7585b424414bc681fa20e31a9/Samples~/FollowBehaviourExample/Sprites/Square.png -------------------------------------------------------------------------------- /Samples~/FollowBehaviourExample/Sprites/Square.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d3d271eff6593a4ca615a76854afea3 3 | TextureImporter: 4 | internalIDToNameTable: 5 | - first: 6 | 213: 7482667652216324306 7 | second: Square 8 | externalObjects: {} 9 | serializedVersion: 11 10 | mipmaps: 11 | mipMapMode: 0 12 | enableMipMap: 0 13 | sRGBTexture: 1 14 | linearTexture: 0 15 | fadeOut: 0 16 | borderMipMap: 0 17 | mipMapsPreserveCoverage: 0 18 | alphaTestReferenceValue: 0.5 19 | mipMapFadeDistanceStart: 1 20 | mipMapFadeDistanceEnd: 3 21 | bumpmap: 22 | convertToNormalMap: 0 23 | externalNormalMap: 0 24 | heightScale: 0.25 25 | normalMapFilter: 0 26 | isReadable: 0 27 | streamingMipmaps: 0 28 | streamingMipmapsPriority: 0 29 | vTOnly: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: 1 35 | maxTextureSize: 2048 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: 1 39 | aniso: -1 40 | mipBias: -100 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 0 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 2 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 256 53 | spriteBorder: {x: 4, y: 4, z: 4, w: 4} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 1 57 | spriteTessellationDetail: 0 58 | textureType: 8 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | flipbookRows: 1 62 | flipbookColumns: 1 63 | maxTextureSizeSet: 0 64 | compressionQualitySet: 0 65 | textureFormatSet: 0 66 | ignorePngGamma: 0 67 | applyGammaDecoding: 0 68 | platformSettings: 69 | - serializedVersion: 3 70 | buildTarget: DefaultTexturePlatform 71 | maxTextureSize: 2048 72 | resizeAlgorithm: 0 73 | textureFormat: -1 74 | textureCompression: 1 75 | compressionQuality: 50 76 | crunchedCompression: 0 77 | allowsAlphaSplitting: 0 78 | overridden: 0 79 | androidETC2FallbackOverride: 0 80 | forceMaximumCompressionQuality_BC6H_BC7: 0 81 | - serializedVersion: 3 82 | buildTarget: Standalone 83 | maxTextureSize: 2048 84 | resizeAlgorithm: 0 85 | textureFormat: -1 86 | textureCompression: 1 87 | compressionQuality: 50 88 | crunchedCompression: 0 89 | allowsAlphaSplitting: 0 90 | overridden: 0 91 | androidETC2FallbackOverride: 0 92 | forceMaximumCompressionQuality_BC6H_BC7: 0 93 | - serializedVersion: 3 94 | buildTarget: iPhone 95 | maxTextureSize: 2048 96 | resizeAlgorithm: 0 97 | textureFormat: -1 98 | textureCompression: 1 99 | compressionQuality: 50 100 | crunchedCompression: 0 101 | allowsAlphaSplitting: 0 102 | overridden: 0 103 | androidETC2FallbackOverride: 0 104 | forceMaximumCompressionQuality_BC6H_BC7: 0 105 | - serializedVersion: 3 106 | buildTarget: Android 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | forceMaximumCompressionQuality_BC6H_BC7: 0 117 | spriteSheet: 118 | serializedVersion: 2 119 | sprites: 120 | - serializedVersion: 2 121 | name: Square 122 | rect: 123 | serializedVersion: 2 124 | x: 0 125 | y: 0 126 | width: 256 127 | height: 256 128 | alignment: 0 129 | pivot: {x: 0.5, y: 0.5} 130 | border: {x: 0, y: 0, z: 0, w: 0} 131 | outline: [] 132 | physicsShape: [] 133 | tessellationDetail: 0 134 | bones: [] 135 | spriteID: 2d009a6b596c7d760800000000000000 136 | internalID: 7482667652216324306 137 | vertices: [] 138 | indices: 139 | edges: [] 140 | weights: [] 141 | outline: [] 142 | physicsShape: 143 | - - {x: -128, y: 128} 144 | - {x: -128, y: -128} 145 | - {x: 128, y: -128} 146 | - {x: 128, y: 128} 147 | bones: [] 148 | spriteID: 5e97eb03825dee720800000000000000 149 | internalID: 0 150 | vertices: [] 151 | indices: 152 | edges: [] 153 | weights: [] 154 | secondaryTextures: [] 155 | spritePackingTag: 156 | pSDRemoveMatte: 0 157 | pSDShowRemoveMatteOption: 0 158 | userData: 159 | assetBundleName: 160 | assetBundleVariant: 161 | -------------------------------------------------------------------------------- /Samples~/ScriptTemplates/82a-Scriptable Action Script-NewScriptableActionScript.cs.txt: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Actions/#SCRIPTNAME#", fileName = "new #SCRIPTNAME#")] 7 | public class #SCRIPTNAME# : ScriptableAction 8 | { 9 | public override void Act(StateComponent stateComponent) 10 | { 11 | throw new System.NotImplementedException(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples~/ScriptTemplates/82b-Scriptable Condition Script-NewScriptableConditionScript.cs.txt: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using loophouse.ScriptableStates; 5 | 6 | [CreateAssetMenu(menuName = "Scriptable State Machine/Conditions/#SCRIPTNAME#", fileName = "new #SCRIPTNAME#")] 7 | public class #SCRIPTNAME# : ScriptableCondition 8 | { 9 | public override bool Verify(StateComponent stateComponent) 10 | { 11 | throw new System.NotImplementedException(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Third Party Notices.md: -------------------------------------------------------------------------------- 1 | This package contains third-party software components governed by the license(s) indicated below: 2 | --- 3 | 4 | Component Name: [Reorderable List](https://github.com/cfoulston/Unity-Reorderable-List) 5 | 6 | License Type: "MIT" 7 | 8 | Copyright (c) 2017 Chris Foulston 9 | 10 | [Reorderable List License](https://github.com/cfoulston/Unity-Reorderable-List/blob/master/LICENSE) 11 | -------------------------------------------------------------------------------- /Third Party Notices.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c144f8330274d5944b50734a23dde97f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.loophouse.scriptable-states", 3 | "version": "0.4.0", 4 | "displayName": "Scriptable States", 5 | "description": "Scriptable Objects based FSM for Unity", 6 | "unity": "2018.4", 7 | "keywords": [ 8 | "FSM" 9 | ], 10 | "author": { 11 | "name": "Luis Oliveira", 12 | "email": "dev.oliveiras@gmail.com", 13 | "url": "https://github.com/luisoliveiras" 14 | }, 15 | "samples": [ 16 | { 17 | "displayName": "ScriptTemplates", 18 | "description": "Script Templates for Scriptable Action and Scriptable Condition", 19 | "path": "Samples~/ScriptTemplates" 20 | }, 21 | { 22 | "displayName": "FollowBehaviourExample", 23 | "description": "Simple implementation of movement, stamina, and follow behaviour using ScriptableStates", 24 | "path": "Samples~/FollowBehaviourExample" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6c7d89fa8b2c9e41a23e06d05c9d09f 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------