FX , VO, fixy

This commit is contained in:
szczuras4
2025-05-03 04:13:47 +02:00
parent 62b2dfa770
commit 5eeda4e515
55 changed files with 108507 additions and 2994 deletions

View File

@@ -0,0 +1,36 @@
using UnityEngine;
namespace Beyond
{
public class PlayerAutoRotator : MonoBehaviour
{
public float rotationSpeed = 5f;
private Transform targetToLook;
private bool shouldRotate = false;
public void LookAtTarget(Transform target)
{
targetToLook = target;
shouldRotate = true;
}
private void Update()
{
if (!shouldRotate || targetToLook == null)
return;
Vector3 direction = (targetToLook.position - transform.position).normalized;
direction.y = 0;
if (direction == Vector3.zero) return;
Quaternion targetRotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * rotationSpeed);
if (Quaternion.Angle(transform.rotation, targetRotation) < 1f)
{
shouldRotate = false;
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3a8f7b2da1584ff49bdad152bbb77744

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;
public class VolumeFadeOut : MonoBehaviour
{
public Volume volume; // Przypisz w Inspectorze lub ustaw dynamicznie
public float fadeDuration = 1.0f; // Czas wygaszania w sekundach
/// <summary>
/// Funkcja do odpalenia z eventu, np. z przycisku lub triggera.
/// </summary>
public void FadeAndDisableVolume()
{
if (volume != null)
StartCoroutine(FadeOutCoroutine());
}
private IEnumerator FadeOutCoroutine()
{
float startWeight = volume.weight;
float elapsed = 0f;
while (elapsed < fadeDuration)
{
elapsed += Time.deltaTime;
volume.weight = Mathf.Lerp(startWeight, 0f, elapsed / fadeDuration);
yield return null;
}
volume.weight = 0f;
volume.enabled = false;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b8f4c5f8a982ee741b546c41519c36de