Первый коммит с LFS.

This commit is contained in:
vladislove committed 2026-01-11 17:04:23 +03:00
1 parent 4fcb1e2f24
commit 179816dc4b
5084 files changed
+3714098 -1

No files matched your search

@@ -0,0 +1,39 @@
using UnityEngine;
namespace Quest_Environment.Q3
{
public class PickupRagAction : MonoBehaviour, IInteractable
{
[Header("Settings")]
public ItemData ragItemData;
public void Interact()
{
if (!(QuestManager.Instance?.currentQuest is Q3_WipeSurfacesQuest))
{
Debug.Log("I have no reason to pick this up right now.");
return;
}
bool added = InventorySystem.Instance.AddItem(ragItemData);
if (added)
{
if (InteractionHandler.Instance != null)
{
InteractionHandler.Instance.NotifyInteraction(gameObject);
}
Destroy(gameObject);
}
}
public string GetDescription()
{
if (QuestManager.Instance?.currentQuest is Q3_WipeSurfacesQuest)
{
return "Take the rag";
}
return "";
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7d76b6445428c35d38032c814918904f
@@ -0,0 +1,144 @@
using UnityEngine;
using Player;
namespace Quest_Environment.Q3
{
public class Q3_WipeSurfacesQuest : MonoBehaviour, IQuest
{
[Header("Quest Settings")]
[SerializeField] private string questName = "Surface Wiping";
[SerializeField] private int surfacesToWipeTotal = 3;
[SerializeField] private ItemData ragItem;
[Header("Target Tags")]
[SerializeField] private string ragGiverTag = "RagLocation";
[SerializeField] private string surfaceTag = "WipeableSurface";
[Header("Audio Settings")]
[SerializeField] private AudioClip pickupRagSound;
[SerializeField] private AudioClip wipeSurfaceSound;
private PlayerController _playerController;
private enum Stage
{
NotStarted,
FindRag,
WipeSurfaces,
Completed
}
private Stage currentStage = Stage.NotStarted;
private int wipedSurfacesCount = 0;
public string QuestName => questName;
public string Description { get; private set; }
public int CurrentStep => wipedSurfacesCount;
public int TotalSteps => surfacesToWipeTotal;
public bool IsCompleted => currentStage == Stage.Completed;
public event System.Action<string> OnQuestStepChanged;
public void StartQuest()
{
if (ragItem == null) Debug.LogError($"[Q3] Rag ItemData is missing!");
currentStage = Stage.FindRag;
wipedSurfacesCount = 0;
PlayerHandsController.Instance?.HideHands();
_playerController = FindObjectOfType<PlayerController>();
if (InteractionHandler.Instance != null)
{
InteractionHandler.Instance.onObjectInteracted += HandleInteraction;
}
UpdateQuestState();
}
private void OnDestroy()
{
if (InteractionHandler.Instance != null)
{
InteractionHandler.Instance.onObjectInteracted -= HandleInteraction;
}
}
private void HandleInteraction(GameObject obj)
{
if (currentStage == Stage.Completed || obj == null) return;
switch (currentStage)
{
case Stage.FindRag:
if (obj.CompareTag(ragGiverTag))
{
currentStage = Stage.WipeSurfaces;
_playerController?.PlayOneShotSound(pickupRagSound);
PlayerHandsController.Instance?.ShowRag(true);
UpdateQuestState();
}
break;
case Stage.WipeSurfaces:
if (obj.CompareTag(surfaceTag))
{
wipedSurfacesCount++;
_playerController?.PlayOneShotSound(wipeSurfaceSound);
QuestManager.Instance.StepCompleted();
if (wipedSurfacesCount >= surfacesToWipeTotal)
{
FinishQuest();
}
else
{
UpdateQuestState();
}
}
break;
}
}
private void UpdateQuestState()
{
switch (currentStage)
{
case Stage.FindRag:
Description = "Find a rag.";
break;
case Stage.WipeSurfaces:
Description = "Wipe the dirty surfaces.";
break;
case Stage.Completed:
Description = "Everything is clean!";
break;
}
OnQuestStepChanged?.Invoke(Description);
}
private void FinishQuest()
{
currentStage = Stage.Completed;
// Hide the rag and remove it from inventory
PlayerHandsController.Instance?.ShowRag(false);
if (ragItem != null)
{
InventorySystem.Instance.RemoveItem(ragItem);
}
UpdateQuestState();
QuestManager.Instance.CompleteQuest();
}
public void AdvanceQuestStep() { }
public void CompleteQuest()
{
if (InteractionHandler.Instance != null)
{
InteractionHandler.Instance.onObjectInteracted -= HandleInteraction;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: eb2201aaa904246a1934c0d3e6804e7a
@@ -0,0 +1,75 @@
using System.Collections;
using UnityEngine;
namespace Quest_Environment.Q3
{
public class WipeableSurface : MonoBehaviour, IInteractable
{
[Header("Settings")]
public ItemData requiredRagItem;
[SerializeField] private float wipeDuration = 1.0f;
[Header("Object References")]
[Tooltip("The clean version of the surface to be activated.")]
[SerializeField] private GameObject cleanSurfaceObject;
[Tooltip("The dirty version of the surface to be deactivated.")]
[SerializeField] private GameObject dirtySurfaceObject;
private bool isWiping = false;
private void Start()
{
// Ensure the clean version is hidden at the start
if (cleanSurfaceObject != null) cleanSurfaceObject.SetActive(false);
}
public void Interact()
{
if (isWiping) return;
bool hasRag = InventorySystem.Instance.HasItem(requiredRagItem);
if (hasRag)
{
if (QuestManager.Instance != null && QuestManager.Instance.currentQuest is Q3_WipeSurfacesQuest)
{
StartCoroutine(WipeRoutine());
}
else
{
Debug.Log("This is dirty, but I have no reason to clean it right now.");
}
}
else
{
Debug.Log("A rag is needed to clean this!");
}
}
private IEnumerator WipeRoutine()
{
isWiping = true;
PlayerHandsController.Instance?.PlayWipeAnimation();
InteractionHandler.Instance.NotifyInteraction(gameObject);
// Wait for the animation to finish
yield return new WaitForSeconds(wipeDuration);
if (dirtySurfaceObject != null) dirtySurfaceObject.SetActive(false);
if (cleanSurfaceObject != null) cleanSurfaceObject.SetActive(true);
Debug.Log("Surface wiped clean!");
// We don't destroy the parent object, just disable this script
// to prevent further interaction.
this.enabled = false;
}
public string GetDescription()
{
if (isWiping || !this.enabled) return "";
return "Wipe surface";
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0b03ffff37f14870a99dcbcc6b88f3ce