void Start() { equippedTool = ToolInformation.ToolInfo[equippedToolId]; timer = new Timer(teleportTimerLength); timer.AutoReset = false; timer.Elapsed += OnTeleportTimerElapsed; }
public bool getCanHarvest(ToolInfoStruct toolInfo, ResourceInfoStruct resource) { if (toolInfo.type == resource.toolType || resource.toolType == ToolTypes.Any) { return(true); } ; return(false); }
public ResourceStruct Interact(ToolInfoStruct toolInfo) { bool canHarvest = getCanHarvest(toolInfo, resource); if (canHarvest) { this.durability -= toolInfo.damage; } if (this.durability <= 0) { InventoryController.instance.IncrementResource(resource.id, resource.count); DestroyThis(); return(new ResourceStruct(resource.id, resource.resourceType, resource.resourceTier, resource.count)); } return(new ResourceStruct(resource.id, resource.resourceType, resource.resourceTier, 0)); }
public void CraftTool(ToolList type) { ToolInfoStruct info = ToolInformation.ToolInfo[type]; Dictionary <ResourceList, int> recipe = info.recipe; foreach (KeyValuePair <ResourceList, int> kvp in recipe) { int value; InventoryController.instance.Inventory.resources.TryGetValue(kvp.Key, out value); if (value >= kvp.Value) { InventoryController.instance.CraftItem(ToolInformation.ToolInfo[type].type, 1); } else { break; } } }
void ChangeEquippedTool(ToolList id) { equippedToolId = id; equippedTool = ToolInformation.ToolInfo[id]; }