コード例 #1
0
        public static void NotifyNewInstance(StateMotor motor, State instance)
        {
            var s = GetAllStates(motor);

            if (!s.Contains(instance))
            {
                s.Add(instance);
            }
        }
コード例 #2
0
        public static void DeleteInstance(StateMotor motor, State state)
        {
            var s = GetAllStates(motor);

            if (s.Contains(state))
            {
                s.Remove(state);
            }

            Object.DestroyImmediate(state, true);
        }
コード例 #3
0
        public static List <State> GetAllStates(StateMotor motor)
        {
            if (StatesCache.ContainsKey(motor))
            {
                return(StatesCache[motor]);
            }

            var path  = AssetDatabase.GetAssetPath(motor);
            var found = AssetDatabase.LoadAllAssetsAtPath(path).OfType <State>().ToList();

            StatesCache[motor] = found;
            return(found);
        }
コード例 #4
0
 public StateSelectorContent(StateMotor motor)
 {
     this.motor = motor;
 }
コード例 #5
0
 public MovementState GetCurrentState(StateMotor motor)
 {
     return(currentState == null ? (currentState = motor.GetDefaultState()) : currentState);
 }
コード例 #6
0
 private void OnEnable()
 {
     motor         = (StateMotor)target;
     stateSelector = new StateSelectorContent(motor);
 }