예제 #1
0
		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 ();

		}
예제 #2
0
	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();
        }
예제 #4
0
    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");
     }
 }
예제 #6
0
    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);
        }
    }
예제 #8
0
		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 ();

		}
예제 #9
0
 private void OnEnable()
 {
     runtimeController = (AIRuntimeController)target;
 }
예제 #10
0
 public static Vector3 GetValue(this AIRuntimeController controller, Vector3Parameter param)
 {
     return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetVector3(param.Name));
 }
예제 #11
0
 public static string GetValue(this AIRuntimeController controller, StringParameter param)
 {
     return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetString(param.Name));
 }
예제 #12
0
 //->
 public static float GetValue(this AIRuntimeController controller, FloatParameter param)
 {
     return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetFloat(param.Name));
 }
예제 #13
0
    public static void SetBool(this AIRuntimeController controller, string name, bool value)
    {
        BoolParameter param = (BoolParameter)controller.GetParameter(name);

        param.Value = value;
    }
예제 #14
0
    public static bool GetBool(this AIRuntimeController controller, string name)
    {
        BoolParameter param = (BoolParameter)controller.GetParameter(name);

        return(param != null ? param.Value : false);
    }
예제 #15
0
 public static GameObject GetValue(this AIRuntimeController controller, GameObjectParameter param)
 {
     return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetGameObject(param.Name));
 }
예제 #16
0
    public static GameObject GetGameObject(this AIRuntimeController controller, string name)
    {
        GameObjectParameter param = (GameObjectParameter)controller.GetParameter(name);

        return(param != null ? param.Value : null);
    }
예제 #17
0
    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>());
 }
예제 #19
0
    public static void SetInt(this AIRuntimeController controller, string name, int value)
    {
        IntParameter param = (IntParameter)controller.GetParameter(name);

        param.Value = value;
    }
예제 #20
0
    public static void SetFloat(this AIRuntimeController controller, string name, float value)
    {
        FloatParameter param = (FloatParameter)controller.GetParameter(name);

        param.Value = value;
    }
예제 #21
0
    public static float GetFloat(this AIRuntimeController controller, string name)
    {
        FloatParameter param = (FloatParameter)controller.GetParameter(name);

        return(param != null ? param.Value : 0);
    }
예제 #22
0
    public static void SetGameObject(this AIRuntimeController controller, string name, GameObject go)
    {
        GameObjectParameter param = (GameObjectParameter)controller.GetParameter(name);

        param.Value = go;
    }
예제 #23
0
    public static int GetInt(this AIRuntimeController controller, string name)
    {
        IntParameter param = (IntParameter)controller.GetParameter(name);

        return(param != null ? param.Value : 0);
    }
예제 #24
0
    public static string GetString(this AIRuntimeController controller, string name)
    {
        StringParameter param = (StringParameter)controller.GetParameter(name);

        return(param != null ? param.Value : string.Empty);
    }
예제 #25
0
	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");
		}
	}
예제 #26
0
    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;
	}