コード例 #1
0
        public void Launch(EngineSettings settings)
        {
            Console.WriteLine ("=====================");
            Console.WriteLine ("Launching Game Engine");
            Console.WriteLine ("=====================");

            // TODO: Should this be dependent on "verbose" flag?
            //Console.WriteDebugLine ("Engine ID: " + engineId);

            var context = EngineContext.New (settings);

            context.Settings.OutputType = ConsoleOutputType.Game;

            context.PopulateFromSettings ();

            context.AddCompleteLogic ();

            context.Initialize ();
            //EngineProcess engine = null; // TODO: Remove if not needed
            try
            {
                using(var engine = new EngineProcess (context))
                {
                    engine.Run();
                }
            }
            catch (GameException ex) {
                context.Console.WriteDebugLine (ex.Message);
            }
            //finally {
            //	if (engine != null)
            //		engine.Dispose ();
        }
コード例 #2
0
 public BuildShelterActivity(Person actor, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console)
     : base(actor, needEntry, settings, console)
 {
     // TODO
     //WoodFelling = new FellWoodActivity ();
     //TimberMilling = new MillTimberActivity ();
 }
コード例 #3
0
ファイル: Inventory.cs プロジェクト: CompulsiveCoder/TileSim
        public Inventory(IHasInventory parent, EngineSettings settings)
        {
            Settings = settings;

            Parent = parent;

            Construct ();
        }
コード例 #4
0
ファイル: Inventory.cs プロジェクト: CompulsiveCoder/TileSim
        public Inventory(IHasInventory parent, DemandList demands, EngineSettings settings)
        {
            Parent = parent;

            Settings = settings;

            Demands = demands;

            Construct ();
        }
コード例 #5
0
ファイル: Person.cs プロジェクト: CompulsiveCoder/TileSim
        public Person(EngineSettings settings)
        {
            Demands = new DemandList (this);
            Inventory = new Inventory (this, Demands, settings);

            Vitals.Add (PersonVitalType.Energy, 100);
            Vitals.Add (PersonVitalType.Health, 100);
            Vitals.Add (PersonVitalType.Thirst, 0);
            Vitals.Add (PersonVitalType.Hunger, 0);
        }
コード例 #6
0
        public BaseActivity(Person actor, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console)
        {
            Actor = actor;
            NeedEntry = needEntry;
            Settings = settings;
            Console = console;

            InitializeItemsProduced ();
            InitializeItemsConsumed ();
        }
コード例 #7
0
        // TODO: Remove if not needed
        /*public EngineClock (DateTime startTime, EngineContext context)
        {
            throw new NotImplementedException ();
            //Context = context;
            //StartTime = startTime;
        }*/
        public EngineClock(EngineSettings settings, ConsoleHelper console)
        {
            Console = console;

            if (settings.IsVerbose)
                Console.WriteDebugLine ("Constructing game engine clock");

            Settings = settings;
            StartTime = DateTime.Now;

            if (settings.IsVerbose)
                Console.WriteDebugLine ("Setting start time to: " + StartTime.ToString());
        }
コード例 #8
0
        public BaseNeedIdentifier(ActivityVerb actionType, ItemType itemType, PersonVitalType vitalType, EngineSettings settings, ConsoleHelper console)
        {
            ActionType = actionType;
            ItemType = itemType;
            VitalType = vitalType;
            Settings = settings;
            Console = console;

            if (vitalType != PersonVitalType.NotSet)
                DefaultPriority = settings.DefaultVitalPriorities [vitalType];
            else if (itemType != ItemType.NotSet)
                DefaultPriority = settings.DefaultItemPriorities [itemType];
        }
コード例 #9
0
        public EngineContext(EngineSettings settings, DataManager data)
        {
            Data = data;

            Settings = settings;

            Console = new ConsoleHelper (Settings);

            Clock = new EngineClock (Settings, Console);

            Info = new EngineInfo (Clock.StartTime, Settings);

            Log = new LogWriter (Settings.EngineId, data.Client);

            World = new GameEnvironment (this);

            if (Settings.IsVerbose)
                Console.WriteDebugLine ("Constructing engine context");
        }
コード例 #10
0
        public static EngineSettings GetSettings(string[] args)
        {
            var arguments = new Arguments (args);

            var settings = new EngineSettings ();

            settings.EngineId = GetEngineId (arguments);

            if (arguments.ContainsAny ("v", "verbose"))
                settings.OutputType = tilesim.Engine.ConsoleOutputType.Debug;

            if (arguments.ContainsAny ("speed"))
                settings.GameSpeed = arguments.GetInt("speed");

            if (settings.IsVerbose) {
                // TODO: Output settings summary
            }

            return settings;
        }
コード例 #11
0
 public PersonEnergyEffect(EngineSettings settings, ConsoleHelper console)
     : base(settings, console)
 {
 }
コード例 #12
0
 public GatherFoodActivity(Person actor, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console)
     : base(actor, needEntry, settings, console)
 {
 }
コード例 #13
0
 public ConsoleHelper(EngineSettings settings)
 {
     Settings = settings;
 }
コード例 #14
0
 public MockGameCreator(EngineSettings settings)
 {
     Settings = settings;
 }
コード例 #15
0
 public StarvationEffect(EngineSettings settings, ConsoleHelper console)
     : base(settings, console)
 {
 }
コード例 #16
0
 public BuildShelterNeedIdentifier(EngineSettings settings, ConsoleHelper console)
     : base(ActivityVerb.Build, ItemType.Shelter, PersonVitalType.NotSet, settings, console)
 {
 }
コード例 #17
0
 public ThirstEffect(EngineSettings settings, ConsoleHelper console)
     : base(settings, console)
 {
 }
コード例 #18
0
 public static EngineContext New(EngineSettings settings)
 {
     return new GameCreator (settings).Create ();
 }
コード例 #19
0
 public PersonCreator(EngineSettings settings)
 {
     Settings = settings;
 }
コード例 #20
0
 public ShelterDecision(EngineSettings settings)
     : base(settings)
 {
 }
コード例 #21
0
ファイル: BaseEffect.cs プロジェクト: CompulsiveCoder/TileSim
 public BaseEffect(EngineSettings settings, ConsoleHelper console)
 {
     Settings = settings;
     Console = console;
 }
コード例 #22
0
ファイル: Building.cs プロジェクト: CompulsiveCoder/TileSim
 public Building(EngineSettings settings)
 {
     Construct (settings);
 }
コード例 #23
0
ファイル: Building.cs プロジェクト: CompulsiveCoder/TileSim
        public Building(BuildingType type, EngineSettings settings)
        {
            Construct (settings);

            Type = type;
        }
コード例 #24
0
ファイル: Building.cs プロジェクト: CompulsiveCoder/TileSim
 public void Construct(EngineSettings settings)
 {
     People = new Person[]{ };
     Inventory = new Inventory (this, settings);
     Settings = settings;
 }
コード例 #25
0
 public FightActivity(Person person, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console)
     : base(person, needEntry, settings, console)
 {
 }
コード例 #26
0
 public MockEngineContext(EngineSettings settings, DataManager data)
     : base(settings, data)
 {
 }
コード例 #27
0
 public HungerEffect(EngineSettings settings, ConsoleHelper console)
     : base(settings, console)
 {
 }
コード例 #28
0
 // TODO: Clean up
 //        public BaseDecision (EngineContext context)
 public BaseDecision(EngineSettings settings)
 {
     Settings = settings;
 }
コード例 #29
0
 public PlayerDeathEffect(EngineSettings settings, ConsoleHelper console)
     : base(settings, console)
 {
 }
コード例 #30
0
 public CollectWaterActivity(Person actor, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console)
     : base(actor, needEntry, settings, console)
 {
 }