feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
111
SVSim.BattleEngine/Engine/UICurveLabel.cs
Normal file
111
SVSim.BattleEngine/Engine/UICurveLabel.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class UICurveLabel : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private int _magnificationHeight;
|
||||
|
||||
[SerializeField]
|
||||
private AnimationCurve _animationCurve;
|
||||
|
||||
private const float HALF_CHARACTER = 0.5f;
|
||||
|
||||
private float _timeIntervalCharacter;
|
||||
|
||||
public void Init(string text)
|
||||
{
|
||||
if (text.Length <= 1)
|
||||
{
|
||||
_timeIntervalCharacter = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_timeIntervalCharacter = 1f / (float)(text.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetTargetCharacterHeight(int inIndex)
|
||||
{
|
||||
return _animationCurve.Evaluate((float)inIndex * _timeIntervalCharacter) * (float)(-_magnificationHeight);
|
||||
}
|
||||
|
||||
private float GetTargetCharacterAnimationCurveValue(float inTime)
|
||||
{
|
||||
return _animationCurve.Evaluate(inTime * _timeIntervalCharacter);
|
||||
}
|
||||
|
||||
public Vector2[] SetTargetCharacterRotation(int inIndex, ref float v0x, ref float v0y, ref float v1x, ref float v1y)
|
||||
{
|
||||
Vector2 vector = default(Vector2);
|
||||
Vector2 vector2 = default(Vector2);
|
||||
if (inIndex == 0)
|
||||
{
|
||||
vector.x = 0f;
|
||||
vector.y = GetTargetCharacterAnimationCurveValue(0f);
|
||||
vector2.x = ((float)inIndex + 0.5f) * _timeIntervalCharacter;
|
||||
vector2.y = GetTargetCharacterAnimationCurveValue((float)inIndex + 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector.x = ((float)inIndex - 0.5f) * _timeIntervalCharacter;
|
||||
vector.y = GetTargetCharacterAnimationCurveValue((float)inIndex - 0.5f);
|
||||
vector2.x = (float)inIndex * _timeIntervalCharacter;
|
||||
vector2.y = GetTargetCharacterAnimationCurveValue(inIndex);
|
||||
}
|
||||
Vector2 vector3 = vector2 - vector;
|
||||
float num = Mathf.Atan2(vector3.y, vector3.x);
|
||||
float num2 = Mathf.Sin(num);
|
||||
float num3 = Mathf.Cos(num);
|
||||
Vector2 vector4 = new Vector2((v1x + v0x) / 2f, (v1y + v0y) / 2f);
|
||||
Vector2[] array = new Vector2[4];
|
||||
array[0].x = v0x;
|
||||
array[0].y = v0y;
|
||||
array[1].x = v0x;
|
||||
array[1].y = v1y;
|
||||
array[2].x = v1x;
|
||||
array[2].y = v1y;
|
||||
array[3].x = v1x;
|
||||
array[3].y = v0y;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
float num4 = array[i].x - vector4.x;
|
||||
float num5 = array[i].y - vector4.y;
|
||||
array[i].x = num3 * num4 - num2 * num5;
|
||||
array[i].y = num2 * num4 + num3 * num5;
|
||||
array[i].x += vector4.x;
|
||||
array[i].y += vector4.y;
|
||||
}
|
||||
Vector2[] array2 = new Vector2[4];
|
||||
if (num < (float)Math.PI / 2f)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
if (num < (float)Math.PI)
|
||||
{
|
||||
array2[0] = array[3];
|
||||
array2[1] = array[0];
|
||||
array2[2] = array[1];
|
||||
array2[3] = array[2];
|
||||
}
|
||||
else if (num < 4.712389f)
|
||||
{
|
||||
array2[0] = array[2];
|
||||
array2[1] = array[3];
|
||||
array2[2] = array[0];
|
||||
array2[3] = array[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
array2[0] = array[1];
|
||||
array2[1] = array[2];
|
||||
array2[2] = array[3];
|
||||
array2[3] = array[0];
|
||||
}
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
array[j] = array2[j];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user