public static bool CanBePlanted(Farm farm, Vector3 cellVector, out bool returnValue) { if (cellVector == -Vector3.One) { returnValue = false; return(true); } Map map = GnomanEmpire.Instance.Map; MapCell cell = map.GetCell(cellVector); if ((bool)UndergroundField.GetValue(farm)) { Mud mud = cell.EmbeddedFloor as Mud; if (mud != null && cell.ProposedJob == null && mud.PlantedSeed == null) { returnValue = true; return(true); } } else { TilledSoil tilledSoil = cell.EmbeddedFloor as TilledSoil; if (tilledSoil != null && cell.ProposedJob == null && tilledSoil.PlantedSeed == null && !(cell.EmbeddedWall is Crop)) { returnValue = true; return(true); } } returnValue = false; return(true); }
public override void Activate() { if (ts == null) { ts = GlobalData.gPlayer.GetComponent <TileSelector>(); } ts.CheckGameObject(); if (ts.mSelectedGameObj == null) { return; } //No object clicked to begin with TilledSoil buf = null; buf = ts.mSelectedGameObj.GetComponent <TilledSoil>(); if (buf != null) { GameObject buf1; buf1 = Instantiate(cropPrefab, ts.mSelectedGameObj.transform); buf1.transform.parent = ts.mSelectedGameObj.transform; --quantity; } }