public static float GetMultiplier(string name, float defaultValue, Workable instance) { try { if (WorkableMultipliersUtils.WorkableConfigTypes.Contains(instance.GetType())) { //Debug.Log("__instance.GetType().FullName: " + instance.GetType().FullName); var workable = WorkableMultipliersConfig.Instance.Workables[instance.GetType().FullName]; //Debug.Log("workable: " + workable); //Debug.Log("workable[" + name + "]: " + workable[name]); if (workable.ContainsKey(name) && workable[name] >= 0f) { return(defaultValue * workable[name]); } } return(defaultValue); } catch (Exception ex) { Debug.LogError(ex); return(defaultValue); } }
/// <summary> /// Marks the direction where a worker was standing. /// </summary> /// <param name="instance">The target workable.</param> /// <param name="worker">The Duplicant working the task.</param> private static void MarkDirection(Workable instance, Worker worker) { var inst = CleanDropManager.Instance; if (inst != null && worker != null) { int targetCell = instance.GetCell(); inst[targetCell] = CleanDropManager.GetWorkerDirection(Grid.PosToCell(worker), targetCell); #if DEBUG Grid.CellToXY(targetCell, out int x, out int y); PUtil.LogDebug("Mark workable {0} in cell ({1:D}, {2:D}) direction = {3}".F( instance.GetType().FullName, x, y, inst[targetCell])); #endif } }