Exemplo n.º 1
0
        public TaskMetaData(string Name, LocationPrerequisite LocationPrereque, StaminaPrerequisite StaminaPrerequisite = null, ToolPrerequisite ToolPrerequisite = null, InventoryFullPrerequisite InventoryFull = null, BedTimePrerequisite bedTimePrereq = null, ItemPrerequisite ItemPrereque = null)
        {
            this.name = Name;
            this.staminaPrerequisite   = StaminaPrerequisite;
            this.toolPrerequisite      = ToolPrerequisite;
            this.inventoryPrerequisite = InventoryFull;
            this.pathsToTake           = new List <List <TileNode> >();
            this.bedTimePrerequisite   = bedTimePrereq;

            this.itemPrerequisite     = ItemPrereque;
            this.locationPrerequisite = LocationPrereque;
            //Make sure to set values correctly incase of null
            setUpLocationPrerequsiteIfNull();
            setUpStaminaPrerequisiteIfNull();
            setUpToolPrerequisiteIfNull();
            setUpInventoryPrerequisiteIfNull();
            setUpBedTimeIfNull();
            setUpItemPrerequisiteIfNull();
            this.prerequisitesList = new List <TaskPrerequisites.GenericPrerequisite>();
            this.prerequisitesList.Add(this.staminaPrerequisite);
            this.prerequisitesList.Add(this.toolPrerequisite);
            this.prerequisitesList.Add(this.inventoryPrerequisite);
            this.prerequisitesList.Add(this.bedTimePrerequisite);
            this.prerequisitesList.Add(this.itemPrerequisite);
        }
Exemplo n.º 2
0
 private void setUpToolPrerequisiteIfNull()
 {
     if (this.toolPrerequisite == null)
     {
         this.toolPrerequisite = new TaskPrerequisites.ToolPrerequisite(false, null, 0);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Used to calculate the weight of using a tool to add to the overall cost of a TaskMetaData cost.
 /// </summary>
 /// <param name="t"></param>
 /// <param name="numberOfTimesToolIsUsed"></param>
 /// <returns></returns>
 public static int calculateToolCostMultiplier(TaskPrerequisites.ToolPrerequisite t)
 {
     if (t.requiresTool == false || t.requiredTool == null)
     {
         return(0);                                                 //Default tool not used.
     }
     return(parseToolCostMultiplier(t) * t.estimatedNumberOfUses);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Used to assign a weight to using a tool a single time.
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static int parseToolCostMultiplier(TaskPrerequisites.ToolPrerequisite t)
        {
            Type tool  = t.requiredTool;
            int  value = 2;
            bool f     = toolCostDictionary.TryGetValue(tool, out value);

            if (f == true)
            {
                return(value);
            }
            else
            {
                return(2);
            }
        }
        public TaskMetaData(string Name, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null, TaskPrerequisites.BedTimePrerequisite bedTimePrereq = null)
        {
            this.name = Name;
            this.staminaPrerequisite   = StaminaPrerequisite;
            this.toolPrerequisite      = ToolPrerequisite;
            this.inventoryPrerequisite = InventoryFull;

            this.bedTimePrerequisite = bedTimePrereq;
            //Make sure to set values correctly incase of null
            setUpStaminaPrerequisiteIfNull();
            setUpToolPrerequisiteIfNull();
            setUpInventoryPrerequisiteIfNull();
            setUpBedTimeIfNull();
            this.prerequisitesList = new List <TaskPrerequisites.GenericPrerequisite>();
            this.prerequisitesList.Add(this.staminaPrerequisite);
            this.prerequisitesList.Add(this.toolPrerequisite);
            this.prerequisitesList.Add(this.inventoryPrerequisite);
            this.prerequisitesList.Add(this.bedTimePrerequisite);
        }
        public TaskMetaData(string Name, float Priority, float Cost, float Utility, float Frequency, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null, TaskPrerequisites.BedTimePrerequisite BedTimePrereq = null)
        {
            this.name                  = Name;
            this.priority              = Priority;
            this.cost                  = Cost;
            this.utility               = Utility;
            this.frequency             = Frequency;
            this.staminaPrerequisite   = StaminaPrerequisite;
            this.toolPrerequisite      = ToolPrerequisite;
            this.inventoryPrerequisite = InventoryFull;
            this.bedTimePrerequisite   = BedTimePrereq;
            //Make sure to set values correctly incase of null
            setUpStaminaPrerequisiteIfNull();
            setUpToolPrerequisiteIfNull();
            setUpInventoryPrerequisiteIfNull();
            setUpBedTimeIfNull();
            this.prerequisitesList = new List <TaskPrerequisites.GenericPrerequisite>();
            this.prerequisitesList.Add(this.staminaPrerequisite);
            this.prerequisitesList.Add(this.toolPrerequisite);
            this.prerequisitesList.Add(this.inventoryPrerequisite);

            this.prerequisitesList.Add(this.bedTimePrerequisite);
        }