mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 17:26:03 +08:00
25 lines
442 B
C#
25 lines
442 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using DG.Tweening;
|
|
|
|
public class PressPlatform : MonoBehaviour
|
|
{
|
|
public float speed = 2;
|
|
|
|
Tweener tween;
|
|
|
|
void Start()
|
|
{
|
|
// Create the tween
|
|
tween = transform.DOLocalMoveY(-4, speed).SetAutoKill(false).Pause();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.DownArrow)) {
|
|
tween.PlayForward();
|
|
} else if (Input.GetKeyUp(KeyCode.DownArrow)) {
|
|
tween.PlayBackwards();
|
|
}
|
|
}
|
|
} |