-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathSeedDefinition.cs
More file actions
54 lines (45 loc) · 1.88 KB
/
SeedDefinition.cs
File metadata and controls
54 lines (45 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#if (IL2CPPMELON || IL2CPPBEPINEX)
using S1Growing = Il2CppScheduleOne.Growing;
#elif (MONOMELON || MONOBEPINEX)
using S1Growing = ScheduleOne.Growing;
#endif
using S1API.Internal.Utils;
using S1API.Items;
namespace S1API.Growing
{
/// <summary>
/// Represents the definition of a Seed item (what you buy in shops).
/// </summary>
public class SeedDefinition : ItemDefinition
{
/// <summary>
/// INTERNAL: Stored reference to the SeedDefinition.
/// </summary>
internal S1Growing.SeedDefinition S1SeedDefinition =>
CrossType.As<S1Growing.SeedDefinition>(S1ItemDefinition);
/// <summary>
/// INTERNAL: Create a new wrapper around an existing SeedDefinition.
/// </summary>
/// <param name="definition">The in-game SeedDefinition to wrap.</param>
internal SeedDefinition(S1Growing.SeedDefinition definition) : base(definition) { }
/// <summary>
/// The prefab that is spawned when planting this seed.
/// </summary>
public UnityEngine.GameObject FunctionalSeedPrefab =>
S1SeedDefinition.FunctionSeedPrefab?.gameObject;
/// <summary>
/// The plant prefab this seed grows into.
/// </summary>
public UnityEngine.GameObject PlantPrefab =>
S1SeedDefinition.PlantPrefab?.gameObject;
/// <summary>
/// Creates an instance of this seed in the world (FunctionalSeed prefab).
/// </summary>
public UnityEngine.GameObject CreateSeedInstance()
{
if (S1SeedDefinition.FunctionSeedPrefab != null)
return UnityEngine.Object.Instantiate(S1SeedDefinition.FunctionSeedPrefab).gameObject;
throw new System.NullReferenceException("No FunctionalSeedPrefab assigned to this SeedDefinition!");
}
}
}