Beispiel #1
0
 /// <summary>
 /// Loads variables into the passed flowchart based on the type arguments.
 /// TBase: Base type that the serializable var containers are for
 /// TSVarType: This save system's serializable variable container
 /// TNSVarType Fungus's built-in not-as-serializable variable container
 /// </summary>
 protected virtual void LoadValueVariables <TBase, TSVarType, TNSVarType>(Flowchart toLoadInto,
                                                                          IList <TSVarType> toLoadFrom)
     where TSVarType : Var <TBase>
     where TNSVarType : BaseFungus.VariableBase <TBase>
 {
     for (int i = 0; i < toLoadFrom.Count; i++)
     {
         var variable = toLoadFrom[i];
         toLoadInto.SetVariable <TBase, TNSVarType>(variable.Key, variable.Value);
     }
 }
Beispiel #2
0
    protected virtual void DoPointerClick()
    {
        if (!clickEnabled)
        {
            return;
        }
        var block = flowchart.FindBlock(blockName);

        if (setVariableToMe != "")
        {
            var variable = flowchart.GetVariable <Variable>(setVariableToMe);
            if (variable == null)
            {
                Debug.LogError("No variable with the name: " + setVariableToMe);
            }
            if (variable is GameObjectVariable)
            {
                var goV = variable as GameObjectVariable;
                goV.Value = gameObject;
                flowchart.SetVariable <GameObjectVariable>(setVariableToMe, goV);
            }
            else if (variable is TransformVariable)
            {
                var tV = variable as TransformVariable;
                tV.Value = transform;
                flowchart.SetVariable <TransformVariable>(setVariableToMe, tV);
            }
            else if (variable is AnimatorVariable)
            {
                var aV = variable as AnimatorVariable;
                aV.Value = GetComponent <Animator>();
                flowchart.SetVariable <AnimatorVariable>(setVariableToMe, aV);
            }
            else
            {
                Debug.LogError("Unsupported variable type: " + setVariableToMe);
            }
        }
        flowchart.ExecuteBlock(block, commandIndex);
    }