public static void ApplyModifierToBranch(TreeBud branch, BuddingTrunk buddingTrunk) { var parentEffects = buddingTrunk?.GetComponent <Effects>(); var branchEffects = branch?.GetComponent <Effects>(); if (parentEffects != null && branchEffects != null && parentEffects.HasEffect(FARMTINKEREFFECTID)) { branchEffects.Add(FARMTINKEREFFECTID, false).timeRemaining = parentEffects.Get(FARMTINKEREFFECTID).timeRemaining; } }
public void OnBranchRemoved(int idx, TreeBud treeBud) { if (idx < 0 || idx >= buds.Length) { Debug.Assert(false, "invalid branch index " + idx); } HarvestDesignatable component = treeBud.GetComponent <HarvestDesignatable>(); HarvestDesignatable harvestDesignatable = (buds[idx] == null) ? null : buds[idx].Get(); if ((Object)component != (Object)harvestDesignatable) { Debug.LogWarningFormat(base.gameObject, "OnBranchRemoved branch {0} does not match known branch {1}", component, harvestDesignatable); } buds[idx] = null; }
public static void ApplyModifierToBranch(TreeBud branch, BuddingTrunk buddingTrunk) { var parentEffects = buddingTrunk?.GetComponent <Effects>(); var branchEffects = branch?.GetComponent <Effects>(); if (parentEffects != null && branchEffects != null) { foreach (var effect_id in CropTendingEffects) { var effectInstanceTrunk = parentEffects.Get(effect_id); if (effectInstanceTrunk != null) { var effectInstanceBranch = branchEffects.Add(effect_id, false); if (effectInstanceBranch != null) { effectInstanceBranch.timeRemaining = effectInstanceTrunk.timeRemaining; } } } } }