21 lines
607 B
C#
21 lines
607 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class IconFloatController : MonoBehaviour {
|
|
[SerializeField] public float floatStrength = 4.0f;
|
|
[SerializeField] public float floatSpeed = 1.0f;
|
|
public Vector3 originalPosition;
|
|
|
|
// Start is called before the first frame update
|
|
void Start() {
|
|
originalPosition = transform.localPosition;
|
|
}
|
|
|
|
void FixedUpdate()
|
|
{
|
|
transform.localPosition = new Vector3(transform.localPosition.x,
|
|
originalPosition.y + Mathf.Sin(Time.time * floatSpeed) * floatStrength);
|
|
}
|
|
}
|