Пример #1
0
        /// <summary>
        /// Startup Delegate to register all Types and Settings.
        /// </summary>
        /// <param name="typeMapper">Reference to the Type Mapper</param>
        /// <param name="settings">Reference to the Extension Settings</param>
        public void Load(ITypeMapper typeMapper, KeyValueStore settings)
        {
            // ##########################
            // Standard Engine Extensions
            // ##########################
            typeMapper.RegisterEngineProperty <InteractionExtension>(this, "Interaction Extension (Core)", 70);
            typeMapper.RegisterEngineProperty <PhysicsExtension>(this, "Physics Extension (Core)", 100);

            settings.Set <RecognitionExtension>("SmellsAliance", false, "Can a Unit smell Smellable Stuff from Aliance Units");
            settings.Set <RecognitionExtension>("SmellsForeign", false, "Can a Unit smell Smellable Stuff from Enemy Units");
            typeMapper.RegisterEngineProperty <RecognitionExtension>(this, "Recognition Extension (Core)", 150);

            // ##########################
            // Standard Item Properties
            // ##########################
            typeMapper.RegisterItemPropertySI <AttackableProperty, AttackableState, AttackableInfo>(this, "Attackable");
            typeMapper.RegisterItemPropertySI <AttackerProperty, AttackerState, AttackerInfo>(this, "Attacker");
            typeMapper.RegisterItemPropertyS <CarrierProperty, CarrierState>(this, "Carrier");
            typeMapper.RegisterItemPropertySI <CollidableProperty, CollidableState, CollidableInfo>(this, "Collidable");
            typeMapper.RegisterItemPropertyS <PortableProperty, PortableState>(this, "Portable");
            typeMapper.RegisterItemPropertyS <SightingProperty, SightingState>(this, "Sighting");                          // keine Info
            typeMapper.RegisterItemPropertyS <SmellableProperty, SmellableState>(this, "Smellable");                       // keine Info
            typeMapper.RegisterItemPropertyS <SnifferProperty, SnifferState>(this, "Sniffer");                             // keine Info
            typeMapper.RegisterItemPropertyS <VisibleProperty, VisibleState>(this, "Visible");                             // keine Info
            typeMapper.RegisterItemPropertyS <WalkingProperty, WalkingState>(this, "Walking");
            typeMapper.RegisterItemPropertyS <AppleCollectorProperty, AppleCollectorState>(this, "Apple Collector");       // keine Info
            typeMapper.RegisterItemPropertyS <SugarCollectorProperty, SugarCollectorState>(this, "Sugar Collector");       // keine Info
            typeMapper.RegisterItemPropertyS <AppleCollectableProperty, AppleCollectableState>(this, "Apple Collectable"); // keine Info
            typeMapper.RegisterItemPropertyS <SugarCollectableProperty, SugarCollectableState>(this, "Sugar Collectable"); // keine Info

            // ##########################
            // Factions registrieren
            // ##########################

            // Ant Faction
            settings.Set <AntFaction>("InitialAnthillCount", 1, "Number of initial Anthills");
            settings.Set <AntFaction>("InitialAntCount", 0, "Number of initial Ants");
            settings.Set <AntFaction>("ConcurrentAntCount", 100, "Number of concurrent Ants");
            settings.Set <AntFaction>("ConcurrentAnthillCount", 1, "Number of concurrent Anthills");
            settings.Set <AntFaction>("TotalAntCount", int.MaxValue, "Total Number of Ants per Simulation");
            settings.Set <AntFaction>("TotalAnthillCount", 1, "Number of total Anthills per Simulation");
            settings.Set <AntFaction>("AntRespawnDelay", 1, "Number of Rounds until another Respawn");
            typeMapper.RegisterFaction <AntFaction, AntFactionState, FactionInfo, AntFactory, AntFactoryInterop, AntUnit, AntUnitInterop>(this, "Ants");

            // Ant Factory Interops
            typeMapper.AttachFactoryInteropProperty <AntFactoryInterop, TotalStatisticsInterop>(this, "Ant Total Statistics", (f, i) =>
            {
                return(new TotalStatisticsInterop(f, i, typeof(AntItem)));
            });
            typeMapper.AttachFactoryInteropProperty <AntFactoryInterop, ByTypeStatisticsInterop>(this, "Ant By Type Statistics", (f, i) =>
            {
                return(new ByTypeStatisticsInterop(f, i, typeof(AntItem)));
            });
            typeMapper.AttachFactoryInteropProperty <AntFactoryInterop, ByCasteStatisticsInterop>(this, "Ant By Caste Statistics", (f, i) =>
            {
                return(new ByCasteStatisticsInterop(f, i, typeof(AntItem)));
            });

            // Ant Unit Interops
            typeMapper.AttachUnitInteropProperty <AntUnitInterop, AntMovementInterop>(this, "Ant Movement Interop");
            typeMapper.AttachUnitInteropProperty <AntUnitInterop, RecognitionInterop>(this, "Ant Recognition Interop");
            typeMapper.AttachUnitInteropProperty <AntUnitInterop, InteractionInterop>(this, "Ant Interaction Interop");

            // Bug Faction
            typeMapper.RegisterFaction <BugFaction, BugFactionState, FactionInfo, BugFactory, BugFactoryInterop, BugUnit, BugUnitInterop>(this, "Bugs");

            // Bug Factory Interops
            typeMapper.AttachFactoryInteropProperty <BugFactoryInterop, TotalStatisticsInterop>(this, "Bug Total Statistics", (f, i) =>
            {
                return(new TotalStatisticsInterop(f, i, typeof(BugItem)));
            });
            typeMapper.AttachFactoryInteropProperty <BugFactoryInterop, ByTypeStatisticsInterop>(this, "Bug By Type Statistics", (f, i) =>
            {
                return(new ByTypeStatisticsInterop(f, i, typeof(BugItem)));
            });

            // Faction Extensions

            // Faction Attatchments


            // ##########################
            // Game Items registrieren
            // ##########################
            RegisterApple(typeMapper, settings);
            RegisterSugar(typeMapper, settings);
            RegisterAnthill(typeMapper, settings);
            RegisterMarker(typeMapper, settings);
            RegisterAnt(typeMapper, settings);
            RegisterBug(typeMapper, settings);
            RegisterClassicBug(typeMapper, settings);
        }