Space-Smash-Out/Assets/Scripts/Indicator3D.cs

26 lines
626 B
C#

using System.Collections;
using System.Collections.Generic;
using PrimeTween;
using UnityEngine;
[ExecuteInEditMode]
public class Indicator3D : MonoBehaviour
{
void OnEnable()
{
WaitTillSpawnThenAnimate();
}
private async void WaitTillSpawnThenAnimate()
{
await Tween.Delay(0.1f);
Sequence.Create(cycles: -1, CycleMode.Rewind, Ease.Default)
.Group(Tween.LocalPosition(gameObject.transform,
gameObject.transform.localPosition - Vector3.forward * 0.001f, 4))
.Group(Tween.LocalRotation(gameObject.transform,
gameObject.transform.localRotation * Quaternion.AngleAxis(180, Vector3.forward), 4));
}
}