Harvestable Destroy

This commit is contained in:
j.mei7
2022-02-18 20:38:23 +01:00
parent 3ff90d47c2
commit d36ddacc4e
6 changed files with 31 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ public abstract class Harvestable : Interactable
[Tooltip("The time for how long the object needs to be harvested.")] [Tooltip("The time for how long the object needs to be harvested.")]
[Range(0.1f, 99.9f)] [Range(0.1f, 99.9f)]
[SerializeField] [SerializeField]
float harvestDuration = 3f; float harvestDuration = 1f;
public ToolType toolType; public ToolType toolType;

View File

@@ -1,11 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class TreeInteraction : Harvestable public class TreeInteraction : Harvestable
{ {
Inventory playerInv;
[SerializeField]
List<Item> drops = new List<Item>();
private void Start() private void Start()
{ {
playerInv = GameObject.Find("Player").GetComponent<Inventory>();
toolType = ToolType.AXE; toolType = ToolType.AXE;
} }
@@ -19,6 +28,13 @@ public class TreeInteraction : Harvestable
} }
public override void Interact() public override void Interact()
{ {
// TODO
// ADD DROPS TO INVENTORY
// START ANIMATION
// DURABILITY ON TOOL
Debug.Log("Harvest BAUM"); Debug.Log("Harvest BAUM");
Destroy(gameObject);
} }
} }

View File

@@ -9,6 +9,7 @@ public abstract class Item : ScriptableObject
public int id; public int id;
public bool isStackable; public bool isStackable;
public Sprite sprite; public Sprite sprite;
public bool isSelected; public bool isSelected;
public abstract void OnSelect(); public abstract void OnSelect();

View File

@@ -9,10 +9,11 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de55e2e3081d4ee4a9d0737e718a5b3b, type: 3} m_Script: {fileID: 11500000, guid: 0fae7bba50a98204883e78d8d6c96fc2, type: 3}
m_Name: Lumber m_Name: Lumber
m_EditorClassIdentifier: m_EditorClassIdentifier:
name: Lumber name:
id: 3 id: 0
isStackable: 1 isStackable: 0
sprite: {fileID: 21300000, guid: 636c61591a702914dadb6abf17d92f6f, type: 3} sprite: {fileID: 0}
isSelected: 0

View File

@@ -9,10 +9,11 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de55e2e3081d4ee4a9d0737e718a5b3b, type: 3} m_Script: {fileID: 11500000, guid: 0fae7bba50a98204883e78d8d6c96fc2, type: 3}
m_Name: Wood m_Name: Wood
m_EditorClassIdentifier: m_EditorClassIdentifier:
name: Wood name:
id: 2 id: 0
isStackable: 1 isStackable: 0
sprite: {fileID: 21300000, guid: 30728ae26107dfe438d180ab175fdaca, type: 3} sprite: {fileID: 0}
isSelected: 0

View File

@@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
[CreateAssetMenu(fileName = "FoodItem", menuName = "Items/FoodItem", order = 2)] [CreateAssetMenu(fileName = "ResourceItem", menuName = "Items/ResourceItem", order = 2)]
public class ResourceItem : Item public class ResourceItem : Item
{ {
public override void OnSelect() public override void OnSelect()