Devtober-Apocalypse-2019/Assets/Scripts/PickupBounce.cs

22 lines
No EOL
471 B
C#

using System;
using UnityEngine;
public class PickupBounce : MonoBehaviour
{
public float floatStrength = 0.1f;
public PlayerController.PickupType type;
private float _originalY;
private void Start()
{
_originalY = transform.position.y;
}
void FixedUpdate()
{
transform.position = new Vector2(
transform.position.x,
_originalY + ((float) Math.Sin(Time.time) * floatStrength)
);
}
}