Adaug proiectul Unity

This commit is contained in:
2026-11-01 23:39:55 +02:00
parent cb14d9d37d
commit 863eac8f2c
23463 changed files with 5412601 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
using UnityEngine;
namespace IllOmen
{
/// <summary>Varies a light's intensity with noise so it reads as a candle flame.</summary>
[RequireComponent(typeof(Light))]
public class CandleFlicker : MonoBehaviour
{
[SerializeField] private float baseIntensity = 6f;
[SerializeField] private float flickerAmount = 1f;
[SerializeField] private float flickerSpeed = 7f;
private Light candleLight;
private void Awake()
{
candleLight = GetComponent<Light>();
}
private void Update()
{
float noise = Mathf.PerlinNoise(Time.time * flickerSpeed, 0f);
candleLight.intensity = baseIntensity + (noise - 0.5f) * 2f * flickerAmount;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 54685d58276cca4428aed1ee733e7a19
+36
View File
@@ -0,0 +1,36 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace IllOmen
{
/// <summary>Lets the player look around with the mouse from a fixed position.</summary>
public class LookAround : MonoBehaviour
{
[SerializeField] private float sensitivity = 0.08f;
[SerializeField] private float maxYaw = 75f;
[SerializeField] private float maxPitch = 40f;
private float yaw;
private float pitch;
private Quaternion startRotation;
private void Start()
{
startRotation = transform.rotation;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
Mouse mouse = Mouse.current;
if (mouse == null) return;
Vector2 delta = mouse.delta.ReadValue() * sensitivity;
yaw = Mathf.Clamp(yaw + delta.x, -maxYaw, maxYaw);
pitch = Mathf.Clamp(pitch - delta.y, -maxPitch, maxPitch);
transform.rotation = startRotation * Quaternion.Euler(pitch, yaw, 0f);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: caf1e3c9597de1d4db63a33519b3226a
+48
View File
@@ -0,0 +1,48 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace IllOmen
{
/// <summary>Free walking for inspecting test scenes: WASD to move, Shift to hurry, mouse to look.</summary>
public class WalkAround : MonoBehaviour
{
[SerializeField] private float walkSpeed = 1.5f;
[SerializeField] private float runSpeed = 3.5f;
[SerializeField] private float sensitivity = 0.08f;
[SerializeField] private float maxPitch = 80f;
private float yaw;
private float pitch;
private void Start()
{
yaw = transform.eulerAngles.y;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
Mouse mouse = Mouse.current;
if (mouse != null)
{
Vector2 delta = mouse.delta.ReadValue() * sensitivity;
yaw += delta.x;
pitch = Mathf.Clamp(pitch - delta.y, -maxPitch, maxPitch);
transform.rotation = Quaternion.Euler(pitch, yaw, 0f);
}
Keyboard keyboard = Keyboard.current;
if (keyboard == null) return;
Vector3 input = Vector3.zero;
if (keyboard.wKey.isPressed) input.z += 1f;
if (keyboard.sKey.isPressed) input.z -= 1f;
if (keyboard.dKey.isPressed) input.x += 1f;
if (keyboard.aKey.isPressed) input.x -= 1f;
float speed = keyboard.leftShiftKey.isPressed ? runSpeed : walkSpeed;
transform.position += Quaternion.Euler(0f, yaw, 0f) * input.normalized * speed * Time.deltaTime;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: daac0206f8a8fac42961777216f686d7