Exemplo n.º 1
0
        public static void RegisterMethods()
        {
            RegisterMethod(new Method <AvailablePart, PartCategories>("Category", p => p == null ? 0 : p.category));
            RegisterMethod(new Method <AvailablePart, float>("Cost", p => p == null ? 0.0f : p.cost));
            RegisterMethod(new Method <AvailablePart, string>("Description", p => p == null ? "" : p.description));
            RegisterMethod(new Method <AvailablePart, string>("Manufacturer", p => p == null ? "" : p.manufacturer));
            RegisterMethod(new Method <AvailablePart, float>("Size", p => p == null ? 0.0f : p.partSize));
            RegisterMethod(new Method <AvailablePart, Tech>("TechRequired", p => p == null ? null : Tech.GetTech(p.TechRequired)));
            RegisterMethod(new Method <AvailablePart, int>("UnlockCost", p => p == null ? 0 : p.entryCost));
            RegisterMethod(new Method <AvailablePart, bool>("IsUnlocked", p => p == null ? false : ResearchAndDevelopment.PartModelPurchased(p), false));
            RegisterMethod(new Method <AvailablePart, int>("CrewCapacity", p => p == null ? 0 : p.partPrefab.CrewCapacity));

            RegisterMethod(new Method <AvailablePart, List <Resource> >("Resources", ResourceList));
            RegisterMethod(new Method <AvailablePart, Resource, double>("ResourceCapacity", ResourceCapacity));

            RegisterMethod(new Method <AvailablePart, float>("EngineAtmosphereThrust", GetEngineAtmoThrust));
            RegisterMethod(new Method <AvailablePart, float>("EngineVacuumThrust", GetEngineVacThrust));
            RegisterMethod(new Method <AvailablePart, float>("EngineAtmosphereISP", GetEngineAtmoISP));
            RegisterMethod(new Method <AvailablePart, float>("EngineVacuumISP", GetEngineVacISP));

            RegisterGlobalFunction(new Function <List <AvailablePart> >("AllParts", () => PartLoader.Instance.parts.ToList()));
            RegisterGlobalFunction(new Function <AvailablePart, AvailablePart>("AvailablePart", p => p));
        }