base constructor for every Item

This commit is contained in:
dhain 2022-05-09 23:39:29 +02:00
parent c3166c5b64
commit 384ce05bb7
8 changed files with 20 additions and 9 deletions

View file

@ -3,7 +3,7 @@ using UnityEngine;
public class Item : MonoBehaviour { public class Item : MonoBehaviour {
private string displayName; private string displayName;
private string description; private string description;
private int id; private int id; //TODO: create an actual ID System that makes snens
public SpriteRenderer spriteRenderer; public SpriteRenderer spriteRenderer;
public Sprite selectedSprite; public Sprite selectedSprite;
public Sprite defaultSprite; public Sprite defaultSprite;
@ -12,6 +12,6 @@ public class Item : MonoBehaviour {
this.displayName = displayName; this.displayName = displayName;
this.description = description; this.description = description;
this.id = id; this.id = id;
spriteRenderer.sprite = defaultSprite; // defaultSprite is set in UnityEditor spriteRenderer.sprite ??= defaultSprite; // defaultSprite is set in UnityEditor
} }
} }

View file

@ -1,6 +1,12 @@
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class FishingRod : MonoBehaviour { public class FishingRod : Item, IUsable {
public FishingRod() : base("Fishing Rod", "Can be used to fish fishy fish.", 1) { }
public void select() {
}
} }
} }

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class Hoe : MonoBehaviour { public class Hoe : Item {
public Hoe() : base("Hoe", "Used to hoe the ground into farmland.", 2){}
} }
} }

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class Scythe : MonoBehaviour { public class Scythe : Item {
public Scythe() : base("Scythe", "Used to cut down crops.", 3){}
} }
} }

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class WateringCan : MonoBehaviour { public class WateringCan : Item {
public WateringCan():base("Watering Can", "Used to water planted crops.", 4){}
} }
} }

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class Wheat : MonoBehaviour { public class Wheat : Item {
public Wheat() : base("Wheat", "Wheat is a grass widely cultivated for its seed, a cereal grain which is a worldwide staple food.", 5){}
} }
} }

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Items { namespace Items {
public class WheatSeed : MonoBehaviour { public class WheatSeed : Item {
public WheatSeed() : base("Wheat Seeds", "When planted on farmland, wheat will grow.", 6){}
} }
} }

View file

@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 0} m_Script: {fileID: 0}
m_Name: m_Name:
m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState
lastWriteTicks: -8585494760213472651 lastWriteTicks: -8585494757829068137