Esempio n. 1
0
 public void SpawnFruit(object callbackParam)
 {
     if (!((UnityEngine.Object) this == (UnityEngine.Object)null))
     {
         CropVal cropVal = this.cropVal;
         if (!string.IsNullOrEmpty(cropVal.cropId))
         {
             GameObject gameObject = Scenario.SpawnPrefab(Grid.PosToCell(base.gameObject), 0, 0, cropVal.cropId, Grid.SceneLayer.Ore);
             if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null)
             {
                 float y = 0.75f;
                 gameObject.transform.SetPosition(gameObject.transform.GetPosition() + new Vector3(0f, y, 0f));
                 gameObject.SetActive(true);
                 PrimaryElement component = gameObject.GetComponent <PrimaryElement>();
                 component.Units       = (float)cropVal.numProduced;
                 component.Temperature = base.gameObject.GetComponent <PrimaryElement>().Temperature;
                 Edible component2 = gameObject.GetComponent <Edible>();
                 if ((bool)component2)
                 {
                     ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, component2.Calories, StringFormatter.Replace(UI.ENDOFDAYREPORT.NOTES.HARVESTED, "{0}", component2.GetProperName()), UI.ENDOFDAYREPORT.NOTES.HARVESTED_CONTEXT);
                 }
             }
             else
             {
                 DebugUtil.LogErrorArgs(base.gameObject, "tried to spawn an invalid crop prefab:", cropVal.cropId);
             }
             Trigger(-1072826864, null);
         }
     }
 }
Esempio n. 2
0
 public void Configure(CropVal cropval)
 {
     cropVal = cropval;
 }