Example #1
0
    static void addCompileSpotMethod(Instruction instruction, ParameterReader parameterReader)
    {
        string method        = parameterReader.readWord();
        string methodLowered = method.ToLower();

        if (methodLowered.Equals("debuglog"))
        {
            DebugLog dl = instruction.AddComponent <DebugLog>();
            dl.textToLog = parameterReader.readString();
            instruction.observers.Add(dl);
        }
        else if (methodLowered.Equals("compile"))
        {
        }
        else if (methodLowered.Equals("dropspikes"))
        {
            DropSpikes ds = instruction.AddComponent <DropSpikes>();
            if (parameterReader.nextWordContains("%"))
            {
                int childIndex = parameterReader.readIndexPosition();
                ds.nbSpikesToDropParameter = instruction.GetChild(childIndex).GetComponent <IntegerParameter>();
                if (ds.nbSpikesToDropParameter == null)
                {
                    log("Instruction doesnt not contain a IntegerParameter at index " + childIndex);
                }
            }
            else
            {
                ds.nbSpikesToDrop = parameterReader.readInt();
            }

            ds.timeBetweenCallMin    = parameterReader.readFloat();
            ds.timeBetweenCallMax    = parameterReader.readFloat();
            ds.spawningOrderAlgoName = parameterReader.readWord();
            instruction.observers.Add(ds);
        }
        else
        {
            Debug.LogError("MAPLOADER - ERROR : Unknown Function type for compile spot " + method);
        }
    }