public void Initialize(AIRuntimeController controller){ this.owner = controller; queueActions = new List<BaseAction> (); updateActions = new List<BaseAction> (); for(int i=0;i< actions.Count;i++) { actions[i]=(BaseAction)ScriptableObject.Instantiate(actions[i]); actions[i].owner=owner; actions[i].OnAwake(); if(actions[i].queue){ queueActions.Add(actions[i]); }else{ updateActions.Add(actions[i]); } } for(int k=0;k<transitions.Count;k++) { transitions[k]=(BaseTransition)ScriptableObject.Instantiate(transitions[k]); for(int i=0;i<transitions[k].conditions.Count;i++){ transitions[k].conditions[i]=(BaseCondition)ScriptableObject.Instantiate(transitions[k].conditions[i]); transitions[k].conditions[i].owner=owner; } transitions[k].owner=owner; } this.DoAwake (); }
protected void setAiController(string aiFilePath){ runtimeController = gameObject.AddComponent<AIRuntimeController> (); AISystem.AIController aic = null; aic = (AISystem.AIController)Resources.Load (aiFilePath); runtimeController.originalController = aic; runtimeController.SetAIController (); }
public void Initialize(AIRuntimeController controller) { this.owner = controller; queueActions = new List <BaseAction> (); updateActions = new List <BaseAction> (); for (int i = 0; i < actions.Count; i++) { actions[i] = (BaseAction)ScriptableObject.Instantiate(actions[i]); actions[i].owner = owner; actions[i].OnAwake(); if (actions[i].queue) { queueActions.Add(actions[i]); } else { updateActions.Add(actions[i]); } } for (int k = 0; k < transitions.Count; k++) { transitions[k] = (BaseTransition)ScriptableObject.Instantiate(transitions[k]); for (int i = 0; i < transitions[k].conditions.Count; i++) { transitions[k].conditions[i] = (BaseCondition)ScriptableObject.Instantiate(transitions[k].conditions[i]); transitions[k].conditions[i].owner = owner; } transitions[k].owner = owner; } this.DoAwake(); }
public static Vector3 GetVector3(this AIRuntimeController controller, string name) { NamedParameter param = controller.GetParameter(name); if (param is GameObjectParameter) { return(((GameObjectParameter)param).Value.transform.position); } Vector3Parameter v = (Vector3Parameter)controller.GetParameter(name); return(v != null ? v.Value : Vector3.zero); }
private void DebugState(State node) { lastDebugController = (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent <AIRuntimeController>() != null) ? Selection.activeGameObject.GetComponent <AIRuntimeController> () : lastDebugController; if (EditorApplication.isPlaying && lastDebugController != null && node.id == lastDebugController.CurrentState.id) { if (lastDebugState == null || lastDebugState.id != node.id) { debugProgress = 0; lastDebugState = node; } GUI.Box(new Rect(node.position.x + 5, node.position.y + 20, debugProgress, 5), "", "MeLivePlayBar"); } }
public static float GetFloatOrInt(this AIRuntimeController controller, string name) { NamedParameter param = controller.GetParameter(name); if (param != null) { if (param is FloatParameter) { return(controller.GetFloat(name)); } else { return(controller.GetInt(name)); } } Debug.Log("null"); return(0); }
private void Update() { if (EditorApplication.isPlaying) { debugProgress += Time.deltaTime * 30; if (debugProgress > 142) { debugProgress = 0; } Repaint(); } if (Selection.activeGameObject != null && Selection.activeGameObject != lastSelection && Selection.activeGameObject.GetComponent <AIRuntimeController> () != null) { lastSelection = Selection.activeGameObject; AIRuntimeController runtime = Selection.activeGameObject.GetComponent <AIRuntimeController>(); Init(runtime.originalController); } }
public void Initialize(AIRuntimeController controller){ this.owner = controller; queueActions = new List<BaseAction> (); updateActions = new List<BaseAction> (); for(int i=0;i< actions.Count;i++) { BaseAction keep = actions[ i ]; if ( actions[ i ] == null ) { continue; } actions[ i ] = (BaseAction)ScriptableObject.Instantiate( actions[ i ] ); if ( actions[ i ] == null ) { Debug.LogError( "Invalid Action! : " + keep.name ); continue; } actions[ i ].owner = owner; actions[i].OnAwake(); if(actions[i].queue){ queueActions.Add(actions[i]); }else{ updateActions.Add(actions[i]); } } for(int k=0;k<transitions.Count;k++) { transitions[k]=(BaseTransition)ScriptableObject.Instantiate(transitions[k]); for(int i=0;i<transitions[k].conditions.Count;i++){ transitions[k].conditions[i]=(BaseCondition)ScriptableObject.Instantiate(transitions[k].conditions[i]); transitions[k].conditions[i].owner=owner; } transitions[k].owner=owner; } this.DoAwake (); }
private void OnEnable() { runtimeController = (AIRuntimeController)target; }
public static Vector3 GetValue(this AIRuntimeController controller, Vector3Parameter param) { return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetVector3(param.Name)); }
public static string GetValue(this AIRuntimeController controller, StringParameter param) { return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetString(param.Name)); }
//-> public static float GetValue(this AIRuntimeController controller, FloatParameter param) { return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetFloat(param.Name)); }
public static void SetBool(this AIRuntimeController controller, string name, bool value) { BoolParameter param = (BoolParameter)controller.GetParameter(name); param.Value = value; }
public static bool GetBool(this AIRuntimeController controller, string name) { BoolParameter param = (BoolParameter)controller.GetParameter(name); return(param != null ? param.Value : false); }
public static GameObject GetValue(this AIRuntimeController controller, GameObjectParameter param) { return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetGameObject(param.Name)); }
public static GameObject GetGameObject(this AIRuntimeController controller, string name) { GameObjectParameter param = (GameObjectParameter)controller.GetParameter(name); return(param != null ? param.Value : null); }
public static void SetVector3(this AIRuntimeController controller, string name, Vector3 value) { Vector3Parameter param = (Vector3Parameter)controller.GetParameter(name); param.Value = value; }
public static Character GetCharacter(this AIRuntimeController ai) { return(ai.GetComponent <Character>()); }
public static void SetInt(this AIRuntimeController controller, string name, int value) { IntParameter param = (IntParameter)controller.GetParameter(name); param.Value = value; }
public static void SetFloat(this AIRuntimeController controller, string name, float value) { FloatParameter param = (FloatParameter)controller.GetParameter(name); param.Value = value; }
public static float GetFloat(this AIRuntimeController controller, string name) { FloatParameter param = (FloatParameter)controller.GetParameter(name); return(param != null ? param.Value : 0); }
public static void SetGameObject(this AIRuntimeController controller, string name, GameObject go) { GameObjectParameter param = (GameObjectParameter)controller.GetParameter(name); param.Value = go; }
public static int GetInt(this AIRuntimeController controller, string name) { IntParameter param = (IntParameter)controller.GetParameter(name); return(param != null ? param.Value : 0); }
public static string GetString(this AIRuntimeController controller, string name) { StringParameter param = (StringParameter)controller.GetParameter(name); return(param != null ? param.Value : string.Empty); }
private void DebugState(State node){ lastDebugController = (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent<AIRuntimeController>() != null) ? Selection.activeGameObject.GetComponent<AIRuntimeController> () : lastDebugController; if (EditorApplication.isPlaying && lastDebugController != null && node.id==lastDebugController.CurrentState.id) { if(lastDebugState== null || lastDebugState.id != node.id){ debugProgress=0; lastDebugState=node; } GUI.Box(new Rect(node.position.x+5,node.position.y+20,debugProgress,5),"", "MeLivePlayBar"); } }
public static void SetString(this AIRuntimeController controller, string name, string value) { StringParameter param = (StringParameter)controller.GetParameter(name); param.Value = value; }
private void OnEnable(){ runtimeController = (AIRuntimeController)target; }