Exemplo n.º 1
0
    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));
        }
    }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
 }