Refactored to ActionInvoker.cs

This commit is contained in:
j-weissen 2022-06-09 16:47:17 +02:00
parent c06d161006
commit afaddd940c
11 changed files with 189 additions and 214 deletions

View file

@ -3,30 +3,11 @@
namespace Tiles {
public class FarmlandTile : BaseTile {
private Crop _crop;
public FarmlandTile(GameObject gameObject) : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_008.png",
gameObject) {
_crop = new Crop(gameObject.transform.GetChild(1).GetComponent<SpriteRenderer>(),
gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>());
}
public override void DayLightStep() {
_crop.DayLightStep();
}
public override BaseTile Clicked(UsableItem usable) {
BaseTile rv = null;
if (usable != null) {
base.Clicked(usable);
_crop.Clicked(usable);
if (ItemContainer.Instance.GetItemIdByName("Shovel") == usable.ID) {
rv = new GrassTile(_gameObject);
}
}
return rv;
public Crop Crop => _crop;
public FarmlandTile() : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_008.png") {
_crop = new Crop();
}
}
}