init
This commit is contained in:
commit
f5c1616018
679 changed files with 188502 additions and 0 deletions
21
Assets/Pixel3D/Scripts/WaterLevelShift.cs
Normal file
21
Assets/Pixel3D/Scripts/WaterLevelShift.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class WaterLevelShift : MonoBehaviour
|
||||
{
|
||||
public float shift = 0.5f;
|
||||
public float speed = 0.5f;
|
||||
|
||||
private float waterLevel = 0f;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
waterLevel = transform.position.y;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
float newY = waterLevel + Mathf.Sin(Time.time * speed) * shift;
|
||||
transform.position = new Vector3(transform.position.x, newY, transform.position.z);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue