Exemplo n.º 1
0
    public void SetFunction(AmiClass amiClass)
    {
        function       = new AmiFunction();
        function.value = amiClass.className;

        function.variables = new List <AmiClass>();
    }
Exemplo n.º 2
0
    public AmiScript CreateScriptFromLines(AmiScript amiScript, List <UIFunctionLine> uifl)
    {
        amiScript.classes = new List <AmiClass>();
        int sequenceID = -1;

        foreach (UIFunctionLine line in uifl)
        {
            if (!line.isParallel)
            {
                print("::::::::::::");
                sequenceID++;
            }
            AmiClass newClass = new AmiClass();
            newClass.className      = line.field.text;
            newClass.argumentValues = new List <AmiArgument>();
            newClass.sequenceID     = sequenceID;
            foreach (UIFunctionVarButton b in line.functionVarButtons)
            {
                AmiArgument arg = new AmiArgument();
                arg.type  = b.arg;
                arg.value = b.GetValue();
                newClass.argumentValues.Add(arg);
            }
            amiScript.classes.Add(newClass);
        }
        return(amiScript);
    }
Exemplo n.º 3
0
 void OnUIClassSelected(AmiClass amiClass)
 {
     if (amiClass.argumentValues.Count > 0)
     {
         AddFunction(amiClass, functionLineContainer);
     }
 }
Exemplo n.º 4
0
    public void Init(Transform parentContainer, AmiClass _amiClass)
    {
        this.amiClass = _amiClass;
        string sentence = Data.Instance.amiClasses.GetSentenceFor(amiClass.className, amiClass.type);

        field.text = sentence;
        transform.SetParent(parentContainer);
    }
Exemplo n.º 5
0
    void OnUIClassSelected(AmiClass animClass)
    {
        AmiClass amiClass = function.variables[lastIArgSelectedID];

        amiClass.className = animClass.className;

        UIFunctionVarButton functionVarButton = functionVarButtons [lastIArgSelectedID];

        functionVarButton.SetValue(animClass.className, lastArgSelected);
    }
Exemplo n.º 6
0
    AmiClass CreateNewClass(string className, AmiClass.types type, int level)
    {
        AmiClass newClass = new AmiClass();

        newClass.className      = className;
        newClass.type           = type;
        newClass.level          = level;
        newClass.argumentValues = new List <AmiArgument>();
        classes.Add(newClass);
        return(newClass);
    }
Exemplo n.º 7
0
    //	foreach (AmiClass amiClass in script.classes) {

    //	}
    //	foreach (UIFunctionLine uifl in parallelSequence.GetComponentsInChildren<UIFunctionLine>()) {
    //	if (!parallelLine.done) {
    //	return false;
    //	}
    //}
    //	return true;
    //}
    float GetFunctionDuration(AmiClass amiClass)
    {
        foreach (AmiArgument type in amiClass.argumentValues)
        {
            if (type.type == AmiClass.types.WAIT)
            {
                return(float.Parse(type.value) / 100);
            }
            if (type.type == AmiClass.types.TIME)
            {
                return(float.Parse(type.value) / 100);
            }
        }
        return(0);
    }
Exemplo n.º 8
0
    public void AddFunction(AmiClass amiClass, Transform _container)
    {
        UIFunctionLine newFunctionLine = Instantiate(functionLine);

        newFunctionLine.gameObject.SetActive(true);
        newFunctionLine.transform.SetParent(_container);
        newFunctionLine.transform.localScale = Vector3.one;

        //print ("argumentValues " + amiClass.argumentValues.Count + " _container " + _container);

        newFunctionLine.Init(amiClass);
        if (_container.name == "FunctionSlot_Childs")
        {
            newFunctionLine.SetParallelOf(_container.GetComponent <UIFunctionSlot>().functionLine);
        }
    }
Exemplo n.º 9
0
    public void Init(AmiClass _amiClass)
    {
        this.amiClass = _amiClass;
        if (amiClass.className == "Parallel")
        {
            childs.SetActive(true);
            bgImage.enabled = false;
        }
        else
        {
            childs.SetActive(false);
            bgImage.enabled = true;
        }

        SetFunction(amiClass);
        field.text = amiClass.className;
        AddArguments();
    }
Exemplo n.º 10
0
    void DragEnd()
    {
        if (overSlot != null && lastClassSelected != "")
        {
            AmiClass ac = Data.Instance.amiClasses.GetClassesByClassName(lastClassSelected);
            uiClassManager.AddFunction(ac, overSlot.container.transform);
        }
        else if (overSlot != null && draggedGO)
        {
            uiClassManager.RepositionateFunction(overSlot, draggedGO);
        }
        else if (overSlot == null && draggedGO != null)
        {
            Destroy(draggedGO);
        }

        draggedGO         = null;
        lastClassSelected = "";
    }
Exemplo n.º 11
0
    public void UpdateFunctions(AmiClass amiClass, float timer)
    {
        GameObject bodyPart  = null;
        float      distance  = 1;
        float      time      = 1;
        string     direction = "";

        foreach (AmiArgument amiArgument in amiClass.argumentValues)
        {
            if (amiArgument.type == AmiClass.types.EXPRESSIONS)
            {
                print("amiArgument.type: " + amiArgument.type + " " + amiArgument.value);
                amiCustomizer.Activate(CharacterCustomizer.parts.HEAD, amiArgument.value);
                return;
            }
            if (amiArgument.type == AmiClass.types.LOOK_AT_TARGET)
            {
                amiLookAt.Activate(amiArgument.value);
                return;
            }
            if (amiArgument.type == AmiClass.types.DIRECTION)
            {
                direction = amiArgument.value;
            }
            if (amiArgument.type == AmiClass.types.DISTANCE)
            {
                distance = float.Parse(amiArgument.value) / 100;
            }
            if (amiArgument.type == AmiClass.types.TIME)
            {
                time = float.Parse(amiArgument.value) / 100;
            }
            if (amiArgument.type == AmiClass.types.BODY_PART)
            {
                bodyPart = GetBodyPartByClassName(amiArgument.value);
            }
        }
        if (direction != "")
        {
            characterRulesToFall.Check(bodyPart);
            amiTween.Move(bodyPart, direction, distance / time);
        }
    }
Exemplo n.º 12
0
    void AddArguments()
    {
        int id = 0;

        foreach (AmiArgument arg in amiClass.argumentValues)
        {
            List <AmiClass> all = Data.Instance.amiClasses.GetClassesByArg(arg.type);

            //no tiene argumentos
            if (all.Count == 0)
            {
                return;
            }

            UIFunctionVarButton newfunctionVarButton = Instantiate(functionVarButton);
            newfunctionVarButton.transform.SetParent(container);
            newfunctionVarButton.transform.localScale = Vector3.one;


            AmiClass newClass = new AmiClass();

            //si el boton es nuevo:
            if (arg.value == null || arg.value == "")
            {
                //	print ("es nuevo");

                newClass.className = all [0].className;
            }
            else
            {
                //print ("estas editando");
                newClass.className = arg.value;
            }

            newClass.type = arg.type;
            function.variables.Add(newClass);
            newfunctionVarButton.Init(this, arg.type, id);
            newfunctionVarButton.SetValue(newClass.className, arg.type);
            functionVarButtons.Add(newfunctionVarButton);

            id++;
        }
    }
Exemplo n.º 13
0
    void UpdateFuncion(AmiClass amiClass)
    {
        float duration = (float)GetFunctionDuration(amiClass);

        if (duration > 0 && duration >= timer)
        {
            //uifl.SetFilled((timer / duration));
        }
        else
        {
            //print ("done " + uifl.function.value);
            amiClass.isDone = true;
            if (IsAllSequenceDone(amiClass.sequenceID))
            {
                activeSequence++;
                timer = 0;
            }


            //if (uifl.function.value == "Parallel") {
            //  activeSequence++;
            //	timer = 0;
            //} else {
            //	if(uifl.parallelOf != null)
            //	{
            //	if (IsParallelSequenceDone (uifl.sequenceID)) {
            //		activeSequence++;
            //		timer = 0;
            //	}
            //	} else {
            //	activeSequence++;

            //	}
            //}
        }
    }
Exemplo n.º 14
0
 void OnUIClassSelected(AmiClass a)
 {
     PlayButton.interactable = true;
 }