fixed clicked() override

This commit is contained in:
j-weissen 2022-06-01 09:36:20 +02:00
parent be04c2263c
commit c9416181fc
4 changed files with 164 additions and 163 deletions

File diff suppressed because it is too large Load diff

View file

@ -38,7 +38,8 @@ public class TileBehaviour : MonoBehaviour
} }
else else
{ {
tile.Clicked(usable); tileToSetTo = tile.Clicked(usable);
Debug.Log("AMOGUS " + tileToSetTo.ToString());
} }
if (tileToSetTo != null) if (tileToSetTo != null)
{ {

View file

@ -29,7 +29,7 @@ namespace Tiles
Debug.Log("I evolve"); Debug.Log("I evolve");
} }
public BaseTile Clicked(UsableItem usable) public virtual BaseTile Clicked(UsableItem usable)
{ {
Debug.Log(usable.ToString() + " used on " + this.ToString()); Debug.Log(usable.ToString() + " used on " + this.ToString());
return null; return null;

View file

@ -14,10 +14,10 @@ namespace Tiles
/// </summary> /// </summary>
/// <param name="usable">the UsableItem that the Tile was clicked on with</param> /// <param name="usable">the UsableItem that the Tile was clicked on with</param>
/// <returns>a subclass of BaseTile if the Tile has to change, null if it stays the same type</returns> /// <returns>a subclass of BaseTile if the Tile has to change, null if it stays the same type</returns>
public new BaseTile Clicked(UsableItem usable) { public override BaseTile Clicked(UsableItem usable) {
base.Clicked(usable); base.Clicked(usable);
BaseTile rv = null; BaseTile rv = null;
if (usable.displayName == "Hoe") if (usable.id == ItemContainer.Instance.GetItemIdByName("Hoe"))
{ {
rv = new FarmlandTile(); rv = new FarmlandTile();
} }