1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 01:36:05 +08:00
2020-01-17 00:11:15 +09:00

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();
}
}
}