46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using DefaultNamespace.ProcessMode;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace DefaultNamespace
|
|
{
|
|
public class TestAnimations : MonoBehaviour
|
|
{
|
|
private AnimationManager animationManager;
|
|
|
|
void Start()
|
|
{
|
|
animationManager = gameObject.AddComponent<AnimationManager>();
|
|
|
|
// 创建并添加动画组 "Group1"
|
|
animationManager.AddAnimationGroup("123", seq =>
|
|
{
|
|
seq.Append(transform.DOMove(new Vector3(3, 0, 0), 1))
|
|
.Join(transform.DORotate(new Vector3(0, 90, 0), 1))
|
|
.Join(transform.DOScale(new Vector3(3, 3, 3), 1));
|
|
|
|
seq.Append(transform.DOMove(new Vector3(6, 0, 0), 1));
|
|
});
|
|
|
|
|
|
|
|
|
|
Debug.Log("动画组已添加");
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.A))
|
|
{
|
|
Debug.Log("按下A");
|
|
animationManager.PlayAnimationGroup("123");
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.B))
|
|
{
|
|
Debug.Log("按下B");
|
|
animationManager.PlayAnimationGroup(1);
|
|
}
|
|
}
|
|
}
|
|
} |