|
| 1 | +#if (IL2CPPMELON || IL2CPPBEPINEX) |
| 2 | +using S1Growing = Il2CppScheduleOne.Growing; |
| 3 | +#elif (MONOMELON || MONOBEPINEX) |
| 4 | +using S1Growing = ScheduleOne.Growing; |
| 5 | +#endif |
| 6 | + |
| 7 | +using S1API.Internal.Utils; |
| 8 | +using S1API.Items; |
| 9 | +using UnityEngine; |
| 10 | + |
| 11 | +namespace S1API.Growing |
| 12 | +{ |
| 13 | + /// <summary> |
| 14 | + /// Represents an instance of a growing plant in the world. |
| 15 | + /// </summary> |
| 16 | + public class PlantInstance |
| 17 | + { |
| 18 | + /// <summary> |
| 19 | + /// INTERNAL: The in-game Plant object. |
| 20 | + /// </summary> |
| 21 | + internal readonly S1Growing.Plant S1Plant; |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// INTERNAL: Create a wrapper around an existing Plant. |
| 25 | + /// </summary> |
| 26 | + /// <param name="plant">The in-game Plant to wrap.</param> |
| 27 | + internal PlantInstance(S1Growing.Plant plant) |
| 28 | + { |
| 29 | + S1Plant = plant; |
| 30 | + } |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// The current growth stage as a float from 0.0 to 1.0. |
| 34 | + /// </summary> |
| 35 | + public float NormalizedGrowth => |
| 36 | + S1Plant.NormalizedGrowthProgress; |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Whether the plant is fully grown. |
| 40 | + /// </summary> |
| 41 | + public bool IsFullyGrown => |
| 42 | + S1Plant.IsFullyGrown; |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// The SeedDefinition that this plant originated from. |
| 46 | + /// </summary> |
| 47 | + public SeedDefinition SeedDefinition => |
| 48 | + new SeedDefinition(S1Plant.SeedDefinition); |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// The quality level of this plant. |
| 52 | + /// </summary> |
| 53 | + public float Quality => |
| 54 | + S1Plant.QualityLevel; |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// The yield level (amount) of this plant. |
| 58 | + /// </summary> |
| 59 | + public float Yield => |
| 60 | + S1Plant.YieldLevel; |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// The GameObject of the plant. |
| 64 | + /// </summary> |
| 65 | + public GameObject GameObject => |
| 66 | + S1Plant.gameObject; |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// Destroys this plant in-game. |
| 70 | + /// </summary> |
| 71 | + /// <param name="dropScraps">Whether to drop trash scraps.</param> |
| 72 | + public void Destroy(bool dropScraps = false) |
| 73 | + { |
| 74 | + S1Plant.Destroy(dropScraps); |
| 75 | + } |
| 76 | + } |
| 77 | +} |
0 commit comments