1
This commit is contained in:
23
Src/UnityPluginsSupport/FPS/ScriptableSprint3.cs
Normal file
23
Src/UnityPluginsSupport/FPS/ScriptableSprint3.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.FPS;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Project.B.FPS
|
||||
{
|
||||
public class ScriptableSprint3 : ScriptableObject,ISprint3
|
||||
{
|
||||
[SerializeField] private Spring3 spring3;
|
||||
|
||||
public Vector3 Value
|
||||
{
|
||||
get => spring3.Value;
|
||||
set => spring3.Value = value;
|
||||
}
|
||||
public void Tick(float deltaTime, Vector3 target)
|
||||
{
|
||||
spring3.Tick(deltaTime, target);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Src/UnityPluginsSupport/FPS/ScriptableSprint3.cs.meta
Normal file
11
Src/UnityPluginsSupport/FPS/ScriptableSprint3.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ba2d7b081cfd404b8ed6d3aa19e574f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -3,9 +3,14 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace BITKit.FPS
|
||||
{
|
||||
{
|
||||
public interface ISprint3
|
||||
{
|
||||
public Vector3 Value { get; set; }
|
||||
void Tick(float deltaTime, Vector3 target);
|
||||
}
|
||||
[Serializable]
|
||||
public class Spring3
|
||||
public class Spring3:ISprint3
|
||||
{
|
||||
public Vector3 value = Vector2.zero;
|
||||
[SerializeField] private Vector3 dampValue = Vector2.zero;
|
||||
@@ -21,7 +26,14 @@ namespace BITKit.FPS
|
||||
this.damp = damp;
|
||||
this.frequence = frequence;
|
||||
}
|
||||
public void Update(float deltaTime, Vector3 target)
|
||||
|
||||
public Vector3 Value
|
||||
{
|
||||
get=>value;
|
||||
set=>this.value=value;
|
||||
}
|
||||
|
||||
public void Tick(float deltaTime, Vector3 target)
|
||||
{
|
||||
value -= dampValue * deltaTime * frequence;
|
||||
dampValue = Vector3.Lerp(dampValue, value - target, deltaTime * damp);
|
||||
|
Reference in New Issue
Block a user