void SimulateStartingKopa() { if (IsPlugged) { WaterPlug.GetComponent <KopaWaterplug>().enabled = true; WaterCopaClue.SetActive(true); WaterParticle.SetActive(false); if (WaterContainer.GetComponent <WaterContainerHeight>()) { WaterContainer.GetComponent <WaterContainerHeight>().AbsorbWater(timeToAbsorbWater); } } else { WaterPlug.GetComponent <KopaWaterplug>().enabled = false; WaterCopaClue.SetActive(false); WaterParticle.SetActive(true); if (WaterContainer.GetComponent <WaterContainerHeight>()) { WaterContainer.GetComponent <WaterContainerHeight>().FillWater(timeToFillWater); } particleStartSpeed = 7.5f; particleStartLifetime = 0.7f; AkSoundEngine.PostEvent("waterfall_loop", gameObject); StartCoroutine(stopSFX(timeToStopSFX)); } }
public static bool OnActivate(GatherWaterInteraction __instance) { try { WorkInProgress.Instance.MyLogger.LogDebug("GatherWaterInteraction"); if (__instance.WaterType != WaterType.Clean && __instance.WaterType != WaterType.Fresh) { return(true); } WorkInProgress.Instance.MyLogger.LogDebug(" > " + __instance.WaterType); WaterContainer waterSkinToFill = __instance.LastCharacter.Inventory.GetWaterSkinToFill(__instance.WaterType); if (waterSkinToFill == null) { return(false); } WorkInProgress.Instance.MyLogger.LogDebug(" > " + waterSkinToFill); if (__instance.WaterType == WaterType.Clean) { AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(waterSkinToFill.GetComponent <ItemStats>(), WorkInProgress.ItemDurabilities[eItemIDs.CleanWater].MaxDurability); } else { AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(waterSkinToFill.GetComponent <ItemStats>(), WorkInProgress.ItemDurabilities[eItemIDs.RiverWater].MaxDurability); } AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(waterSkinToFill, waterSkinToFill.MaxDurability); waterSkinToFill.gameObject.AddComponent <Perishable>(); } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("GatherWaterInteraction_OnActivate: " + ex.Message); } return(true); }
public void CalculateMaxArea(int[] height, int expectedArea) { var container = new WaterContainer(); var result = container.MaxArea(height); Assert.Equal(expectedArea, result); }
public void WhenWaterContainerIsEmpty_FillingItUp_CausesCorrectWaterLevel() { // arrange WaterContainer water = new WaterContainer(0); // act water.FillUpWater(); // assert Assert.AreEqual(5, water.Level); }
public void WhenWaterContainerIsEmpty_FillingItUp_CausesCorrectWaterLevel() { // There seems to be no relationship between the container // and the tap - so how will the tap cause any change // to the container? WaterContainer waterC = new WaterContainer(0); WaterTap tap = new WaterTap(); // The method that you shared with us is called: // FillUpWater, but this is calling FillUpContainer waterC = tap.FillUpContainer(); // You create a variable named: // waterC, but use WaterC here (C# is case sensitive) Assert.AreEqual(5, WaterC.Level); }
public static void OnUse(WaterContainer __instance, Character _targetChar) { try { if (__instance.IsEmpty) { AccessTools.Field(typeof(Perishable), "m_baseDepletionRate").SetValue(__instance.GetComponent <Perishable>(), 0f); AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(__instance, -1); AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(__instance.GetComponent <ItemStats>(), -1); } } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("Item_OnUse: " + ex.Message); } }
public static void Fill(WaterContainer __instance, WaterType _waterType) { try { //WorkInProgress.Instance.MyLogger.LogDebug("Fill"); if (_waterType == WaterType.Clean || _waterType == WaterType.Fresh) { if (_waterType == WaterType.Clean) { AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(__instance.GetComponent <ItemStats>(), WorkInProgress.ItemDurabilities[eItemIDs.CleanWater].MaxDurability); } else { AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(__instance.GetComponent <ItemStats>(), WorkInProgress.ItemDurabilities[eItemIDs.RiverWater].MaxDurability); } AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(__instance, __instance.MaxDurability); AccessTools.Field(typeof(Perishable), "m_baseDepletionRate").SetValue(__instance.GetComponent <Perishable>(), WorkInProgress.ItemDurabilities[eItemIDs.RiverWater].DepletionRate); } } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("Fill: " + ex.Message); } }
static void Main(string[] args) { Power power = new Power(); WaterContainer water = new WaterContainer(); Filter filter = new Filter(); Powder powder = new Powder(); TeaFlavor flavor = new TeaFlavor(); while (true) { Console.WriteLine("Options:\n 1: Power option\n 2: Fill water\n 3: Insert filter\n 4: Remove filter\n 5: Choose drink"); int choice = int.Parse(Console.ReadLine()); Console.Clear(); switch (choice) { case 1: Console.WriteLine(" 1: Turn on\n 2: Turn off"); choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: Console.WriteLine(power.PowerOn(powder.containPowder, water.water)); break; case 2: Console.WriteLine(power.PowerOff()); break; } break; case 2: Console.WriteLine(" 1: Add water in ML: "); choice = int.Parse(Console.ReadLine()); Console.WriteLine(water.AddWater(choice)); break; case 3: Console.WriteLine(filter.AddFilter()); break; case 4: Console.WriteLine(filter.RemoveFilter(powder.containPowder)); break; case 5: Console.WriteLine(" 1: Coffe\n 2: The"); choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: Console.WriteLine("How many scoops of powder?"); choice = int.Parse(Console.ReadLine()); Console.WriteLine(powder.AddPowder(choice, filter.filter)); break; case 2: Console.WriteLine("What flavor {0}", flavor.Flavor()); break; } break; case 6: break; } } }
static bool WaterContainer_RefreshDisplay_Pre(WaterContainer __instance) { __instance.m_stackable.m_maxStackAmount = _waterskinCapacity; return(true); }