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.")]
[Range(0.1f, 99.9f)]
[SerializeField]
float harvestDuration = 3f;
float harvestDuration = 1f;
public ToolType toolType;

View File

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

View File

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

View File

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

View File

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

View File

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