mirror of
https://github.com/DerTyp7/example-top-down-unity.git
synced 2025-10-29 20:42:08 +01:00
Harvestable Destroy
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user