protected override int Convert(MedicineWithDoses value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) { return(99); } return(CountdownHelper.CalcCountDownValue(value)); }
void Awake() { movementController = GetComponent <CharacterMovement>(); courierController = GetComponent <Courier_Controller>(); movementController.onStartMove += OnStartMove; movementController.onStopMove += OnStopMove; countdown = new CountdownHelper(1); animator = GetComponentInChildren <Animator>(); }
public void Test_CalcCountDownForMedNoTimes_Is99() { var time = new DateTime(2016, 2, 25, 8, 0, 0); var medWithDoses = new MedicineWithDoses(new Medicine(), () => time); var count = CountdownHelper.CalcCountDownValue(medWithDoses, () => time); Assert.AreEqual(99, count); }
public void Test_CalcCountDownForMed_Pref_LunchDinner_AfterDinner_IsCorrect() { var time = new DateTime(2016, 2, 25, 22, 0, 0); var medWithDoses = new MedicineWithDoses(new Medicine(), () => time); medWithDoses.AddDoseTimes(new[] { TimeOfDay.Lunch, TimeOfDay.Dinner }); var count = CountdownHelper.CalcCountDownValue(medWithDoses, () => time); Assert.AreEqual(94, count); }
public void Test_CalcCountDownForMed_Pref_Lunch_IsCorrect() { var time = new DateTime(2016, 2, 25, 8, 0, 0); var medWithDoses = new MedicineWithDoses(new Medicine(), () => time); medWithDoses.AddDoseTime(TimeOfDay.Lunch); var count = CountdownHelper.CalcCountDownValue(medWithDoses, () => time); Assert.AreEqual(25, count); }
public void Init(Item producerAsItem, Producer _producer, Tile_Data _baseTile) { producer = _producer; if (_baseTile.AddProducer(producer) == false) { return; } base.InitMachine(producerAsItem, producer, _baseTile, ShipManager.instance); // The machine controller sets the list of Neighbor tiles, // then we Add the producers on neighbor tiles as well foreach (Tile_Data tile in neighborTiles) { tile.AddProducer(producer); } item_Manager = Item_Manager.instance; timer = new CountdownHelper(0); //storage_inventory = new Inventory(1); inventory_Controller = GetComponentInChildren <Inventory_Controller>(); inventory_Controller.Initialize(ID_Generator.instance.GetMachineID(this), 1); // Position the growth visuals X correctly according to the machine's tile width if (growth_visuals != null) { growth_visuals.transform.localPosition = new Vector2(producer.tileWidth > 1 ? 0.5f : 0, 0.5f); } Debug.Log("Initialized a producer with a blueprint for " + producer.current_Blueprint.itemProduced.itemName); // This runs when a producer has already started producing before if (producer.current_Blueprint.itemProduced.count > 0 && producer.productionStage >= 0) { if (producer.productionStage >= 3) { itemInProduction = item_Manager.CreateInstance(item_Manager.GetPrototype(producer.current_Blueprint.itemProduced.itemName)); SetGrowthVisuals(); CompleteProduction(); return; } StartProduction(true); return; } SetProductionStage(0); // Debug.Log("Producer INITIALIZED: " + " key ingredient = " + producer.productionBlueprints[0].keyIngredient.count + " " + producer.productionBlueprints[0].keyIngredient.itemName + // " secondary ingredient " + producer.productionBlueprints[0].secondaryIngredients[0].count + " " + producer.productionBlueprints[0].secondaryIngredients[0].itemName); }
void Awake() { instance = this; notifications = new Queue <Notification>(); countdown = new CountdownHelper(timeBetweenNotes); }
public void Test_CalcCountDownForNullMed() { var count = CountdownHelper.CalcCountDownValue(null); Assert.AreEqual(0, count); }
public TransitState(StateType sType) : base (sType){ countdown = new CountdownHelper(timePerJump); }