123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using I2.Loc;
- using Sirenix.OdinInspector;
- using SK.Framework;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEditor;
- using UnityEngine;
- public class ToolTest01 : ToolAnimationBase
- {
- public enum UpdateMode
- {
- FixedUpdate,
- Update,
- LateUpdate,
- }
- [SerializeField] private SimpleBezierCurvePath path;
- [SerializeField] private float speed = 0.2f;
- [SerializeField] private UpdateMode updateMode = UpdateMode.Update;
- private float normalized = 0f;
- private Vector3 lastPosition;
- public float normailFloor = 0.01f;
- public float index;
- [HideInInspector]
- public MeshPoint meshPoint;
- public override void EditorPlayUpdate(ToolAnimationItem toolAnimationItem, bool reverse)
- {
- if (path == null)
- {
- return;
- }
- index += speed * Time.deltaTime;
- meshPoint = path.GetPos(index);
- meshPoint.position = meshPoint.position + meshPoint.normail.normalized * normailFloor;
- toolAnimationItem.toolAnchor.position = Vector3.Lerp(toolAnimationItem.toolAnchor.position, meshPoint.position, 0.5f);
- toolAnimationItem.toolAnchor.forward = Vector3.Slerp(toolAnimationItem.toolAnchor.forward, meshPoint.normail, speed);
- if (index > 1)
- {
- index = 0;
- toolAnimationItem.isPlaying = false;
- }
- }
- public override void FinishedState(ToolAnimationItem toolAnimationItem, bool reverse)
- {
- throw new System.NotImplementedException();
- }
- public override void InitState(ToolAnimationItem toolAnimationItem, bool reverse)
- {
- throw new System.NotImplementedException();
- }
- public override void PlayTrigger(ToolAnimationItem toolAnimationItem, bool reverse)
- {
- throw new System.NotImplementedException();
- }
- public override void StopPlay(ToolAnimationItem toolAnimationItem, bool reverse)
- {
- throw new System.NotImplementedException();
- }
- }
|