2026-02-05 05:07:55 -08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
|
|
|
|
|
|
public class craftingWorkbenchSystem : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
[Header ("Main Setting")]
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public int workbenchID;
|
|
|
|
|
|
|
2026-03-29 23:03:14 -07:00
|
|
|
|
public bool allowToCraftAllObjectsOnCurrentBench;
|
|
|
|
|
|
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public bool setObjectCategoriesToCraftAvailableOnCurrentBench;
|
2026-02-05 05:07:55 -08:00
|
|
|
|
|
|
|
|
|
|
public List<string> objectCategoriesToCraftAvailableOnCurrentBench = new List<string> ();
|
|
|
|
|
|
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
[Header ("Repair/Disassemble/Upgrade Setting")]
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public bool repairObjectsOnlyOnWorkbenchEnabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
public bool disassembleObjectsOnlyOnWorkbenchEnabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
public bool upgradeObjectsOnlyOnWorkbencheEnabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
[Header ("Other Setting")]
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public bool showCurrentObjectMesh;
|
|
|
|
|
|
|
|
|
|
|
|
public Transform currentObjectMeshPlaceTransform;
|
|
|
|
|
|
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
[Header ("Inventory Bank Setting")]
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public bool storeCraftedObjectsOnInventoryBank;
|
|
|
|
|
|
|
2026-03-29 23:03:14 -07:00
|
|
|
|
public bool storeCraftedObjectsOnInventoryBankOnlyIfPlayerInventoryIsFull;
|
|
|
|
|
|
|
2026-02-05 05:07:55 -08:00
|
|
|
|
public inventoryBankSystem mainInventoryBankSystem;
|
|
|
|
|
|
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
[Header ("Event Setting")]
|
|
|
|
|
|
[Space]
|
|
|
|
|
|
|
|
|
|
|
|
public UnityEvent eventToStopUsingWorkbenchOnDamageReceived;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void activateWorkbench (GameObject currentPlayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (currentPlayer == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
playerComponentsManager currentplayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
|
|
|
|
|
|
|
|
|
|
|
if (currentplayerComponentsManager != null) {
|
|
|
|
|
|
craftingSystem currentCraftingSystem = currentplayerComponentsManager.getCraftingSystem ();
|
|
|
|
|
|
|
|
|
|
|
|
if (currentCraftingSystem != null) {
|
|
|
|
|
|
currentCraftingSystem.setCurrentcurrentCraftingWorkbenchSystem (this);
|
|
|
|
|
|
|
|
|
|
|
|
if (setObjectCategoriesToCraftAvailableOnCurrentBench) {
|
2026-03-29 23:03:14 -07:00
|
|
|
|
currentCraftingSystem.setOpenFromWorkbenchState (true, objectCategoriesToCraftAvailableOnCurrentBench,
|
|
|
|
|
|
allowToCraftAllObjectsOnCurrentBench);
|
2026-02-05 05:07:55 -08:00
|
|
|
|
} else {
|
2026-03-29 23:03:14 -07:00
|
|
|
|
currentCraftingSystem.setOpenFromWorkbenchState (true, null, allowToCraftAllObjectsOnCurrentBench);
|
2026-02-05 05:07:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void deactivateWorkBench (GameObject currentPlayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (currentPlayer == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
playerComponentsManager currentplayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
|
|
|
|
|
|
|
|
|
|
|
if (currentplayerComponentsManager != null) {
|
|
|
|
|
|
craftingSystem currentCraftingSystem = currentplayerComponentsManager.getCraftingSystem ();
|
|
|
|
|
|
|
|
|
|
|
|
if (currentCraftingSystem != null) {
|
|
|
|
|
|
currentCraftingSystem.setCurrentcurrentCraftingWorkbenchSystem (null);
|
|
|
|
|
|
|
2026-03-29 23:03:14 -07:00
|
|
|
|
currentCraftingSystem.setOpenFromWorkbenchState (false, null, false);
|
2026-02-05 05:07:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addInventoryObjectByName (string objectName, int amountToMove)
|
|
|
|
|
|
{
|
|
|
|
|
|
mainInventoryBankSystem.addInventoryObjectByName (objectName, amountToMove);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void checkEventToStopUsingWorkbenchOnDamageReceived ()
|
|
|
|
|
|
{
|
|
|
|
|
|
eventToStopUsingWorkbenchOnDamageReceived.Invoke ();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getWorkbenchID ()
|
|
|
|
|
|
{
|
|
|
|
|
|
return workbenchID;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|