public Option(float weightValue, IBlackboard bbValue)
 {
     weight = new BBParameter <float> {
         value = weightValue, bb = bbValue
     };
     condition = null;
 }
Пример #2
0
        public FSMConnection ConectTo(FSMState anotherState, ConditionTask condition)
        {
            FSMConnection connection = new FSMConnection(this, anotherState, _fsm);

            connection.SetCondition(condition);
            return(connection);
        }
Пример #3
0
        public static ISimpleTask Secret(params ISimpleTask[] list)
        {
            var secretList = list.ToList();

            secretList.Add(new SetGameTagTask(GameTag.REVEALED, 1, EntityType.SOURCE));
            secretList.Add(new MoveToGraveYard(EntityType.SOURCE));
            var checkIsOpponentTurnTask = new ConditionTask(EntityType.SOURCE, SelfCondition.IsOpTurn);

            return(Create(checkIsOpponentTurnTask, new FlagTask(true, StateTaskList <ISimpleTask> .Chain(secretList.ToArray()))));
        }
Пример #4
0
 public static ISimpleTask RecursiveTask(ConditionTask repeatCondition, params ISimpleTask[] tasks)
 {
     ISimpleTask[] taskList = new ISimpleTask[tasks.Length + 2];
     tasks.CopyTo(taskList, 0);
     taskList[tasks.Length]     = repeatCondition;
     taskList[tasks.Length + 1] =
         new FlagTask(true,
                      new FuncNumberTask(p =>
     {
         p.ActivateTask(PowerActivation.POWER);
         return(0);
     }
                                         ));
     return(StateTaskList.Chain(taskList));
 }
Пример #5
0
        public static ISimpleTask RecursiveSpellTask(ConditionTask repeatCondition, params ISimpleTask[] tasks)
        {
            var taskList = tasks.ToList();

            taskList.Add(repeatCondition);
            taskList.Add(
                new FlagTask(true,
                             new EnqueueTask(1, Create(
                                                 new IncludeTask(EntityType.SOURCE),
                                                 new FuncPlayablesTask(p =>
            {
                p[0].ApplyEnchantments(EnchantmentActivation.SPELL, Zone.GRAVEYARD);
                return(p);
            }
                                                                       )))));
            return(StateTaskList <ISimpleTask> .Chain(taskList.ToArray()));
        }
Пример #6
0
        protected override BehaviorTask createTask()
        {
            ConditionTask pTask = new ConditionTask();

            return(pTask);
        }
Пример #7
0
        protected override BehaviorTask createTask()
        {
            ConditionTask pTask = new ConditionTask();

            return pTask;
        }
Пример #8
0
 public void SetCondition(ConditionTask condition)
 {
     _condition = condition;
 }
Пример #9
0
		void AddCondition(ConditionTask condition){

			if (condition is ConditionList){
				Debug.LogWarning("Adding an ConditionList within an ConditionList is not allowed");
				return;
			}

			#if UNITY_EDITOR
			if (!Application.isPlaying){
				Undo.RecordObject(ownerSystem.baseObject, "List Add Task");
				currentViewCondition = condition;
			}
			#endif
			
			conditions.Add(condition);
			condition.SetOwnerSystem(this.ownerSystem);
		}
Пример #10
0
		public void DoLoadPreset(){
			#if !UNITY_WEBPLAYER
            var path = EditorUtility.OpenFilePanel("Load Preset", "Assets", "conditionList");
            if (!string.IsNullOrEmpty(path)){
                var json = System.IO.File.ReadAllText(path);
                var list = JSON.Deserialize<ConditionList>(json);
                this.conditions = list.conditions;
                this.checkMode = list.checkMode;
                this.currentViewCondition = null;
                foreach(var a in conditions){
                	a.SetOwnerSystem(this.ownerSystem);
                }
            }				
            #else
            Debug.LogWarning("Preset loading is not possible with WebPlayer as active platform");
            #endif
		}
Пример #11
0
		public void ShowNestedConditionsGUI(){

			if (conditions.Count == 1)
				currentViewCondition = conditions[0];

			if (currentViewCondition != null){
				EditorUtils.Separator();
				Task.ShowTaskInspectorGUI(currentViewCondition, (c)=>
				{
					if (c == null){
						var i = conditions.IndexOf(currentViewCondition);
						conditions.RemoveAt(i);
					}
					currentViewCondition = (ConditionTask)c;
				});
			}
		}
Пример #12
0
		public void ShowListGUI(){

			EditorUtils.TaskSelectionButton<ConditionTask>(ownerSystem, (c)=>{ AddCondition(c) ;});

			ValidateList();

			if (conditions.Count == 0){
				EditorGUILayout.HelpBox("No Conditions", MessageType.None);
				return;
			}

			if (conditions.Count == 1)
				return;
			
			EditorUtils.ReorderableList(conditions, delegate(int i){

				var condition = conditions[i];
				GUI.color = new Color(1, 1, 1, 0.25f);
				GUILayout.BeginHorizontal("box");

				GUI.color = condition.isActive? new Color(1,1,1,0.8f) : new Color(1,1,1,0.25f);

				condition.isActive = EditorGUILayout.Toggle(condition.isActive, GUILayout.Width(18));

				GUI.backgroundColor = condition == currentViewCondition? Color.grey : Color.white;
				if (GUILayout.Button(EditorUtils.viewIcon, GUILayout.Width(25), GUILayout.Height(18)))
					currentViewCondition = condition == currentViewCondition? null : condition;
				EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
				GUI.backgroundColor = Color.white;
				GUILayout.Label(condition.summaryInfo, GUILayout.MinWidth(0), GUILayout.ExpandWidth(true));
				
				if (!Application.isPlaying && GUILayout.Button("X", GUILayout.MaxWidth(20))){
					Undo.RecordObject(ownerSystem.baseObject, "List Remove Task");
					conditions.RemoveAt(i);
				}

				EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
				GUILayout.EndHorizontal();
				GUI.color = Color.white;
			});

			checkMode = (ConditionsCheckMode)EditorGUILayout.EnumPopup(checkMode);
		}
Пример #13
0
 ////////////////////////////////////////
 ///////////GUI AND EDITOR STUFF/////////
 ////////////////////////////////////////
         #if UNITY_EDITOR
 protected override void OnNodeInspectorGUI()
 {
     if (condition == null)
     {
         EditorUtils.TaskSelectionButton(gameObject, typeof(ConditionTask), delegate(Task c){ condition = (ConditionTask)c; });
     }
     else
     {
         condition.ShowInspectorGUI();
     }
 }
Пример #14
0
        public ITask Create(IAction action)
        {
            ITask task = null;

            if (taskDic.TryGetValue(action.ActionType, out task))
            {
                return(task);
            }

            if (action.ActionType == ActionType.PageAction)
            {
                task = new PageTask(manager);
            }
            else if (action.ActionType == ActionType.BrowserAction)
            {
                task = new BrowserTask(manager);
            }
            else if (action.ActionType == ActionType.FindAction)
            {
                task = new FindTask(manager);
            }
            else if (action.ActionType == ActionType.MouseAction)
            {
                task = new MouseTask(manager);
            }
            else if (action.ActionType == ActionType.AttributeAction)
            {
                task = new AttributeTask(manager);
            }
            else if (action.ActionType == ActionType.ScrollAction)
            {
                task = new ScrollTask(manager);
            }
            else if (action.ActionType == ActionType.ClearDataAction)
            {
                task = new ClearDataTask(manager);
            }
            else if (action.ActionType == ActionType.WaitAction)
            {
                task = new WaitTask(manager);
            }
            else if (action.ActionType == ActionType.ClickAction)
            {
                task = new ClickTask(manager);
            }
            else if (action.ActionType == ActionType.KeyboardAction)
            {
                task = new KeyboardTask(manager);
            }
            else if (action.ActionType == ActionType.SendKeyAction)
            {
                task = new SendKeyTask(manager);
            }
            else if (action.ActionType == ActionType.ConditionAction)
            {
                task = new ConditionTask(manager);
            }
            else if (action.ActionType == ActionType.ClearHistoryAction)
            {
                task = new ClearHistoryTask(manager);
            }
            else if (action.ActionType == ActionType.TextAction)
            {
                task = new TextTask(manager);
            }
            else if (action.ActionType == ActionType.ScriptAction)
            {
                task = new ScriptTask(manager);
            }
            else if (action.ActionType == ActionType.PackageAction)
            {
                task = new PackageTask(manager);
            }

            taskDic.Add(action.ActionType, task);

            return(task);
        }