-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…-2623] (Unity-Technologies#674) * Infrastructure and Gameplay folder and assembly refactor * added reference to utils asmdef from applicationcontroller.asmdef
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
{ | ||
"name": "Unity.BossRoom.Audio", | ||
"references":[ "GUID:ec2e12d3de28e40839f9a0b685184f49" ] | ||
} | ||
"name": "Unity.BossRoom.Audio", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:59b3bd604d0445f583783872c3e648fc" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using UnityEngine; | ||
|
||
namespace Unity.Multiplayer.Samples.BossRoom.Visual | ||
{ | ||
/// <summary> | ||
/// Utility struct to linearly interpolate between two Vector3 values. Allows for flexible linear interpolations | ||
/// where current and target change over time. | ||
/// </summary> | ||
public struct PositionLerper | ||
{ | ||
// Calculated start for the most recent interpolation | ||
Vector3 m_LerpStart; | ||
|
||
// Calculated time elapsed for the most recent interpolation | ||
float m_CurrentLerpTime; | ||
|
||
// The duration of the interpolation, in seconds | ||
float m_LerpTime; | ||
|
||
public PositionLerper(Vector3 start, float lerpTime) | ||
{ | ||
m_LerpStart = start; | ||
m_CurrentLerpTime = 0f; | ||
m_LerpTime = lerpTime; | ||
} | ||
|
||
/// <summary> | ||
/// Linearly interpolate between two Vector3 values. | ||
/// </summary> | ||
/// <param name="current"> Start of the interpolation. </param> | ||
/// <param name="target"> End of the interpolation. </param> | ||
/// <returns> A Vector3 value between current and target. </returns> | ||
public Vector3 LerpPosition(Vector3 current, Vector3 target) | ||
{ | ||
if (current != target) | ||
{ | ||
m_LerpStart = current; | ||
m_CurrentLerpTime = 0f; | ||
} | ||
|
||
m_CurrentLerpTime += Time.deltaTime; | ||
if (m_CurrentLerpTime > m_LerpTime) | ||
{ | ||
m_CurrentLerpTime = m_LerpTime; | ||
} | ||
|
||
var lerpPercentage = m_CurrentLerpTime / m_LerpTime; | ||
|
||
return Vector3.Lerp(m_LerpStart, target, lerpPercentage); | ||
} | ||
} | ||
} |