Exemplo n.º 1
0
 private void OnEnable()
 {
     Ready = false;
     Animator.SetTrigger("Idle");
     Animator.SetBool("Walk", false);
     Action               = AI_Actions.IDLE;
     CurrentTime          = 0f;
     transform.localScale = Vector3.one;
 }
Exemplo n.º 2
0
    public override void DrawNode()
    {
        GUILayout.BeginHorizontal();

        GUILayoutOption op = GUILayout.MinWidth(300);

        Action = (AI_Actions)EditorGUILayout.EnumPopup("Action : ", Action, op);

        if (Event.current.type == EventType.Repaint)
        {
            if (Linkers[(int)Node.LinkType.To])
            {
                Linkers[(int)Node.LinkType.To].SetRect(new Rect(
                                                           rect.x + rect.width / 2,
                                                           rect.y + rect.height,
                                                           16,
                                                           16));
            }

            if (Linkers[(int)Node.LinkType.From])
            {
                Linkers[(int)Node.LinkType.From].SetRect(new Rect(
                                                             rect.x + rect.width / 2,
                                                             rect.y - 16,
                                                             16,
                                                             16));
            }
        }

        GUILayout.EndHorizontal();

        ActionFunction.DrawGUI();


        if (GUI.changed)
        {
            Node_Editor.editor.RecalculateFrom(this);

            if (oldAction != Action)
            {
                var type = System.Type.GetType(AI_ActionsDico[(int)Action]);
                ActionFunction = (ActionNodeFunctions)System.Activator.CreateInstance(type);
                oldAction      = Action;
            }
        }
    }