void CompileTimeLine(NodeCode parent, int index, CodeBlock targetFunctionBlock)
    {
        CodeBlock TimeLineCodeBlock = new CodeBlock(new Variable()
        {
            Var = "void TimeLine_" + index + "()"
        }, new List <ICodeBase>());

        targetFunctionBlock.CommandLines.Add(TimeLineCodeBlock);

        ((CodeBlock)(targetFunctionBlock.CommandLines[1])).CommandLines.Add(new Variable(
                                                                                "TimelineEvents.Add(new TimeLineEvent(" + parent.logicParamCode.ToCodeText() + ", TimeLine_" + index + "));\n"
                                                                                ));

        List <NodePointData> flowPoint   = parent.GetPointData(ConnectionPointType.Out);
        NodePointData        currentFlow = flowPoint[0];

        if (currentFlow.connections.Count == 0)
        {
            return;
        }

        NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);

        CompileFunction(nextCode, TimeLineCodeBlock);
    }
Beispiel #2
0
    public void AttachParameter()
    {
        List <NodePointData> parameterPoint = GetPointData(ConnectionPointType.Parameter);

        foreach (var param in parameterPoint)
        {
            if (param.connections.Count == 0)
            {
                Variable var = new Variable();
                if (param.parameterType == typeof(string).FullName)
                {
                    var.Var = "\"" + param.cachedValue + "\"";
                }
                else if (param.parameterType == typeof(float).FullName)
                {
                    var.Var = param.cachedValue + "f";
                }
                else if (param.parameterType == typeof(bool).FullName)
                {
                    var.Var = param.cachedValue.ToLower();
                }
                else
                {
                    var.Var = param.cachedValue;
                }

                if (connectMapping.ContainsKey(param.GUID))
                {
                    connectMapping[param.GUID].connectiongAction.Invoke(var);
                }
            }
            else
            {
                NodeCode paramCode = guidMap.GetCode(guidMap.GetData <NodePointData>(guidMap.GetData <NodeConnectionData>(param.connections[0]).outGUID).nodeGUID);
                connectMapping[param.GUID].connectiongAction.Invoke(paramCode.code);
            }
        }
    }