You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AllIn1VfxToolkit
|
|
|
|
|
|
{
|
|
|
|
|
|
public class AllIn1VfxBounceAnimation : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
[SerializeField] private Vector3 targetOffset = Vector3.up;
|
|
|
|
|
|
[SerializeField] private float speed = 1f;
|
|
|
|
|
|
|
|
|
|
|
|
private Vector3 startPosition, animationMovementVector;
|
|
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
startPosition = transform.position;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
animationMovementVector = targetOffset * ((Mathf.Sin(Time.time * speed) + 1f) / 2f);
|
|
|
|
|
|
transform.position = startPosition + animationMovementVector;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|