예제 #1
0
    public static SpawnEventPrototype Builder(Table table)
    {
        SpawnEventPrototype proto = new SpawnEventPrototype();

        PullData(table, proto);
        return(proto);
    }
예제 #2
0
    public static SpellAction ParseAndCreateSpell(string fileName)
    {
        if (allAbilites == null)
        {
            allAbilites = new Dictionary <string, SpellAction>();
        }

        LuaFile file = new LuaFile();

        file.Setup("Spells/" + fileName);
        SpellAction newSpell = new SpellAction();

        newSpell.name         = file.GetValue("Name").ToString();
        newSpell.targetType   = (TargetType)Convert.ToInt32(file.GetValue("TargetType"));
        newSpell.targetFilter = (TargetFilter)Convert.ToInt32(file.GetValue("TargetFilter"));
        newSpell.targetRange  = (TargetRange)Convert.ToInt32(file.GetValue("TargetRange"));
        newSpell.targetAOE    = (TargetAOE)Convert.ToInt32(file.GetValue("TargetAOE"));
        if (newSpell.targetRange == TargetRange.Range)
        {
            newSpell.range = Convert.ToInt32(file.GetValue("Range"));
        }
        else
        {
            newSpell.range = 1;
        }

        Table table = (Table)file.GetValue("Events");
        Table insideTable;

        foreach (DynValue dy in table.Values)
        {
            insideTable = dy.Table;
            switch (insideTable.Get("Type").String)
            {
            case "DamageEvent":
                newSpell.protoEvents.Add(DamageEventPrototype.Builder(insideTable));
                break;

            case "SpawnEvent":
                newSpell.protoEvents.Add(SpawnEventPrototype.Builder(insideTable));
                break;

            case "BuffCastEvent":
                newSpell.protoEvents.Add(BuffCastEventPrototype.Builder(insideTable));
                break;

            default:
                break;
            }
        }
        return(newSpell);
    }
예제 #3
0
 private static void PullData(Table table, SpawnEventPrototype proto)
 {
     proto.lifeLength     = (int)table.Get("LifeLength").Number;
     proto.controllerType = (spawnableAIType)(int)table.Get("LifeLength").Number;
     proto.spawnAsset     = table.Get("Spawnable").String;
 }
예제 #4
0
 private static void PullData(Table table, SpawnEventPrototype proto)
 {
     proto.lifeLength = (int)table.Get("LifeLength").Number;
     proto.controllerType = (spawnableAIType)(int)table.Get("LifeLength").Number;
     proto.spawnAsset = table.Get("Spawnable").String;
 }
예제 #5
0
 public static SpawnEventPrototype Builder(Table table)
 {
     SpawnEventPrototype proto = new SpawnEventPrototype();
     PullData(table, proto);
     return proto;
 }