您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
41 行
875 B
41 行
875 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using UnityEngine.XR.ARSubsystems;
|
|
|
|
public class AnimatedPlaceObject : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
Transform m_PlacementSphere;
|
|
|
|
public float ShakeVal;
|
|
|
|
public Ease MoveEase;
|
|
|
|
void Update()
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (Input.GetKeyDown(KeyCode.A))
|
|
{
|
|
m_PlacementSphere.localPosition = new Vector3(0, 0.375f, 0);
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
AnimatePlacement();
|
|
}
|
|
#endif
|
|
}
|
|
|
|
public void AnimatePlacement()
|
|
{
|
|
m_PlacementSphere.DOLocalMove(Vector3.zero, 0.1f).SetEase(MoveEase).OnComplete(BounceLand);
|
|
}
|
|
|
|
void BounceLand()
|
|
{
|
|
m_PlacementSphere.DOShakeScale(0.1f, ShakeVal);
|
|
}
|
|
}
|