-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWaveBob.cs
42 lines (34 loc) · 1.09 KB
/
WaveBob.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.Scripting;
using UnityEngine.UI;
using System.Collections.Generic;
using ReikaKalseki.DIAlterra;
using ReikaKalseki.SeaToSea;
using SMLHelper.V2.Handlers;
using SMLHelper.V2.Utility;
namespace ReikaKalseki.SeaToSea
{
[Serializable]
//[ProtoContract]
//[ProtoInclude(30000, typeof(WaveBob))]
internal class WaveBob : MonoBehaviour {
public Vector3 rootPosition = Vector3.zero;
public double speed = 0.5;
public double amplitude = 1;
public double speed2Ratio = 2.5;
public double amplitude2Ratio = 0.1;
void Start() {
}
void Update() {
double y = amplitude*Math.Sin((speed*DayNightCycle.main.timePassedAsDouble)%(20*Math.PI));
if (amplitude2Ratio > 0)
y += amplitude*amplitude2Ratio*Math.Sin((speed*speed2Ratio*DayNightCycle.main.timePassedAsDouble+238239)%(20*Math.PI));
gameObject.transform.position = new Vector3(rootPosition.x, rootPosition.y+(float)y, rootPosition.z);
}
}
}