Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitFertilizer.cs
1using System;
2using UnityEngine;
3
4// Token: 0x020003A6 RID: 934
5public class TraitFertilizer : Trait
6{
7 // Token: 0x1700085C RID: 2140
8 // (get) Token: 0x06001BF4 RID: 7156 RVA: 0x000A8A45 File Offset: 0x000A6C45
9 public override bool CanExtendBuild
10 {
11 get
12 {
13 return true;
14 }
15 }
16
17 // Token: 0x1700085D RID: 2141
18 // (get) Token: 0x06001BF5 RID: 7157 RVA: 0x000A8A48 File Offset: 0x000A6C48
19 public bool Defertilize
20 {
21 get
22 {
23 return this is TraitDefertilizer;
24 }
25 }
26
27 // Token: 0x06001BF6 RID: 7158 RVA: 0x000A8A54 File Offset: 0x000A6C54
28 public override void OnSimulateHour(VirtualDate date)
29 {
30 if (!this.owner.IsInstalled)
31 {
32 return;
33 }
34 PlantData plantData = EClass._map.TryGetPlant(this.owner.Cell);
35 if (this.Defertilize)
36 {
37 if (plantData == null)
38 {
39 plantData = EClass._map.AddPlant(this.owner.pos, null);
40 }
41 plantData.fert = -1;
42 }
43 else
44 {
45 foreach (Card card in this.owner.pos.ListCards(false))
46 {
47 if (card.trait is TraitSeed && !card.isSale)
48 {
49 (card.trait as TraitSeed).TrySprout(true, true, null);
50 break;
51 }
52 }
53 if (!this.owner.pos.HasObj)
54 {
55 EClass._map.SetObj(this.owner.pos.x, this.owner.pos.z, 5, 1, 0);
56 }
57 else if (plantData == null)
58 {
59 if (this.owner.pos.growth == null)
60 {
61 return;
62 }
63 this.owner.pos.growth.TryGrow(date);
64 }
65 else if (plantData.fert == 0 && this.owner.pos.growth != null)
66 {
67 this.owner.pos.growth.TryGrow(date);
68 }
69 plantData = EClass._map.TryGetPlant(this.owner.Cell);
70 if (plantData != null)
71 {
72 plantData.fert++;
73 }
74 }
75 if (date.IsRealTime)
76 {
77 this.owner.PlaySound("mutation", 1f, true);
78 this.owner.PlayEffect("mutation", true, 0f, default(Vector3));
79 }
80 this.owner.Destroy();
81 }
82}
Definition Card.cs:13
Definition Trait.cs:9