chore: Assets 디렉토리 구조 정리 및 네이밍 컨벤션 적용
- Assets/_Game/ 하위로 게임 에셋 통합 - External/ 패키지 벤더별 분류 (Synty, Animations, UI) - 에셋 네이밍 컨벤션 확립 및 적용 (Data_Skill_, Data_SkillEffect_, Prefab_, Anim_, Model_, BT_ 등) - pre-commit hook으로 네이밍 컨벤션 자동 검사 추가 - RESTRUCTURE_CHECKLIST.md 작성 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
44
Assets/External/Models/PolygonGeneric/Scripts/Generic_WaterBob.cs
vendored
Normal file
44
Assets/External/Models/PolygonGeneric/Scripts/Generic_WaterBob.cs
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Generic_WaterBob : MonoBehaviour
|
||||
{
|
||||
public float bobbingHeight = 0.08f; // The height the object will bob up and down
|
||||
public float bobbingSpeed = 1.5f; // The speed of the bobbing motion
|
||||
public float rotationAmount = 0.8f; // The amount of rotation applied to the object
|
||||
public bool randomOffset = true; // Determines if random offsets are applied to speed and rotation
|
||||
public Vector2 randomRange = new Vector2(0.1f, 1f); // The range for the random offset
|
||||
private Vector3 startPos;
|
||||
private Quaternion startRotation;
|
||||
|
||||
void Start()
|
||||
{
|
||||
startPos = transform.position;
|
||||
startRotation = transform.rotation; // Save the initial rotation
|
||||
|
||||
if (randomOffset)
|
||||
{
|
||||
bobbingSpeed += UnityEngine.Random.Range(randomRange.x, randomRange.y);
|
||||
rotationAmount += UnityEngine.Random.Range(randomRange.x, randomRange.y);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// Calculate the vertical bobbing motion
|
||||
float newY = startPos.y + Mathf.Sin(Time.time * bobbingSpeed) * bobbingHeight;
|
||||
Vector3 newPos = new Vector3(transform.position.x, newY, transform.position.z);
|
||||
transform.position = newPos;
|
||||
|
||||
// Calculate rotation offsets based on time
|
||||
float rotationX = Mathf.Sin(Time.time * bobbingSpeed * 0.5f) * rotationAmount;
|
||||
float rotationY = Mathf.Sin(Time.time * bobbingSpeed * 0.7f) * rotationAmount;
|
||||
float rotationZ = Mathf.Sin(Time.time * bobbingSpeed * 0.9f) * rotationAmount;
|
||||
|
||||
// Apply the incremental rotation as an offset to the existing rotation
|
||||
Quaternion incrementalRotation = Quaternion.Euler(rotationX, rotationY, rotationZ);
|
||||
transform.rotation = startRotation * incrementalRotation;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user