ui基本完毕,修了一大把的bug
This commit is contained in:
+66
-6
@@ -54,12 +54,12 @@ MonoBehaviour:
|
||||
iManaMinusSprite: {fileID: 21300000, guid: ab8b33f8f7d77e242b0da39cdebae043, type: 3}
|
||||
iIscorePlusSprite: {fileID: 21300000, guid: e49d4f09f0f1b0646bf8fccb5dc816b7, type: 3}
|
||||
iIscoreMinusSprite: {fileID: 21300000, guid: 629ef934809d32949a40ad47b1d13356, type: 3}
|
||||
iDamageColor: {r: 0.97647065, g: 0.38823533, b: 0.45098042, a: 0}
|
||||
iHealColor: {r: 0.19215688, g: 0.8117648, b: 0.63529414, a: 0}
|
||||
iManaPlusColor: {r: 0, g: 0.9490197, b: 0.9960785, a: 0}
|
||||
iManaMinusColor: {r: 0.30980393, g: 0.67058825, b: 0.9960785, a: 0}
|
||||
iIscorePlusColor: {r: 0.73333335, g: 0.8000001, b: 1, a: 0}
|
||||
iIscoreMinusColor: {r: 0.7019608, g: 0.38823533, b: 0.92549026, a: 0}
|
||||
iDamageColor: {r: 0.97647065, g: 0.38823533, b: 0.45098042, a: 1}
|
||||
iHealColor: {r: 0.19215688, g: 0.8117648, b: 0.63529414, a: 1}
|
||||
iManaPlusColor: {r: 0, g: 0.9490197, b: 0.9960785, a: 1}
|
||||
iManaMinusColor: {r: 0.30980393, g: 0.67058825, b: 0.9960785, a: 1}
|
||||
iIscorePlusColor: {r: 0.73333335, g: 0.8000001, b: 1, a: 1}
|
||||
iIscoreMinusColor: {r: 0.7019608, g: 0.38823533, b: 0.92549026, a: 1}
|
||||
this_prefab_gravity: -9.81
|
||||
x_ofst: 0
|
||||
y_ofst: 0
|
||||
@@ -70,6 +70,66 @@ MonoBehaviour:
|
||||
jump_force: 125
|
||||
fadeout_awaitTime: 0.25
|
||||
fadeout_time: 0.25
|
||||
verticalTravelDistance: 110
|
||||
horizontalDriftMin: 18
|
||||
horizontalDriftMax: 42
|
||||
verticalMotionCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 4.5
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.58
|
||||
value: 1
|
||||
inSlope: 0.12
|
||||
outSlope: 0.12
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0.42
|
||||
inSlope: -2.4
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
horizontalMotionCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 2.2
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0.2
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &5029723704172947119
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
+68
-8
@@ -54,12 +54,12 @@ MonoBehaviour:
|
||||
iManaMinusSprite: {fileID: 21300000, guid: ab8b33f8f7d77e242b0da39cdebae043, type: 3}
|
||||
iIscorePlusSprite: {fileID: 21300000, guid: e49d4f09f0f1b0646bf8fccb5dc816b7, type: 3}
|
||||
iIscoreMinusSprite: {fileID: 21300000, guid: 629ef934809d32949a40ad47b1d13356, type: 3}
|
||||
iDamageColor: {r: 0.97647065, g: 0.38823533, b: 0.45098042, a: 0}
|
||||
iHealColor: {r: 0.19215688, g: 0.8117648, b: 0.63529414, a: 0}
|
||||
iManaPlusColor: {r: 0, g: 0.9490197, b: 0.9960785, a: 0}
|
||||
iManaMinusColor: {r: 0.30980393, g: 0.67058825, b: 0.9960785, a: 0}
|
||||
iIscorePlusColor: {r: 0.73333335, g: 0.8000001, b: 1, a: 0}
|
||||
iIscoreMinusColor: {r: 0.7019608, g: 0.38823533, b: 0.92549026, a: 0}
|
||||
iDamageColor: {r: 0.97647065, g: 0.38823533, b: 0.45098042, a: 1}
|
||||
iHealColor: {r: 0.19215688, g: 0.8117648, b: 0.63529414, a: 1}
|
||||
iManaPlusColor: {r: 0, g: 0.9490197, b: 0.9960785, a: 1}
|
||||
iManaMinusColor: {r: 0.30980393, g: 0.67058825, b: 0.9960785, a: 1}
|
||||
iIscorePlusColor: {r: 0.73333335, g: 0.8000001, b: 1, a: 1}
|
||||
iIscoreMinusColor: {r: 0.7019608, g: 0.38823533, b: 0.92549026, a: 1}
|
||||
this_prefab_gravity: -9.81
|
||||
x_ofst: 0
|
||||
y_ofst: 0
|
||||
@@ -70,6 +70,66 @@ MonoBehaviour:
|
||||
jump_force: 125
|
||||
fadeout_awaitTime: 0.5
|
||||
fadeout_time: 0.25
|
||||
verticalTravelDistance: 110
|
||||
horizontalDriftMin: 18
|
||||
horizontalDriftMax: 42
|
||||
verticalMotionCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 4.5
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.58
|
||||
value: 1
|
||||
inSlope: 0.12
|
||||
outSlope: 0.12
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0.42
|
||||
inSlope: -2.4
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
horizontalMotionCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 2.2
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0.2
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &5029723704172947119
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -137,8 +197,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: 2147483647
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
m_sharedMaterial: {fileID: -346136068272202111, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 7cad3f54ac7b53d4885f00c16f1a6929, type: 2}
|
||||
m_sharedMaterial: {fileID: -346136068272202111, guid: 7cad3f54ac7b53d4885f00c16f1a6929, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
|
||||
+57
-13
@@ -39,6 +39,22 @@ public class playerInstantNumbersPrefab : MonoBehaviour
|
||||
public float fadeout_awaitTime;
|
||||
public float fadeout_time = 0.25f;
|
||||
|
||||
[Header("motion feel")]
|
||||
[Tooltip("Total height reached by the popup before it starts dropping back down.")]
|
||||
public float verticalTravelDistance = 110f;
|
||||
[Tooltip("Random horizontal drift distance applied over the popup lifetime.")]
|
||||
public float horizontalDriftMin = 18f;
|
||||
public float horizontalDriftMax = 42f;
|
||||
[Tooltip("Controls the fast-rise, slow-peak, then drop feel. 0=start, 1=end.")]
|
||||
public AnimationCurve verticalMotionCurve = new AnimationCurve(
|
||||
new Keyframe(0f, 0f, 0f, 4.5f),
|
||||
new Keyframe(0.58f, 1f, 0.12f, 0.12f),
|
||||
new Keyframe(1f, 0.42f, -2.4f, 0f));
|
||||
[Tooltip("Controls horizontal drift over lifetime. This is multiplied by a random left/right distance.")]
|
||||
public AnimationCurve horizontalMotionCurve = new AnimationCurve(
|
||||
new Keyframe(0f, 0f, 0f, 2.2f),
|
||||
new Keyframe(1f, 1f, 0.2f, 0f));
|
||||
|
||||
private RectTransform _rectTransform;
|
||||
private CanvasGroup _canvasGroup;
|
||||
private Coroutine _animationCoroutine;
|
||||
@@ -151,10 +167,16 @@ public class playerInstantNumbersPrefab : MonoBehaviour
|
||||
|
||||
Vector2 baseOffset = new Vector2(x_ofst, y_ofst);
|
||||
Vector2 randomOffset = Random.insideUnitCircle * xy_rdm_spawnP;
|
||||
Vector2 finalOffset = baseOffset + randomOffset;
|
||||
Vector2 spawnOffset = baseOffset + randomOffset;
|
||||
|
||||
if (useAnchored) _rectTransform.anchoredPosition = startAnchoredPos + finalOffset;
|
||||
else transform.localPosition = startLocalPos + new Vector3(finalOffset.x, finalOffset.y, 0f);
|
||||
float horizontalDirection = Random.value < 0.5f ? -1f : 1f;
|
||||
float horizontalDistance = horizontalDirection * Random.Range(
|
||||
Mathf.Min(horizontalDriftMin, horizontalDriftMax),
|
||||
Mathf.Max(horizontalDriftMin, horizontalDriftMax));
|
||||
float verticalDistance = Mathf.Max(0f, verticalTravelDistance);
|
||||
|
||||
if (useAnchored) _rectTransform.anchoredPosition = startAnchoredPos + spawnOffset;
|
||||
else transform.localPosition = startLocalPos + new Vector3(spawnOffset.x, spawnOffset.y, 0f);
|
||||
|
||||
float zRot = Random.Range(-rdm_rotation_range, rdm_rotation_range);
|
||||
transform.localRotation = Quaternion.Euler(0f, 0f, zRot);
|
||||
@@ -162,28 +184,25 @@ public class playerInstantNumbersPrefab : MonoBehaviour
|
||||
float scale = Random.Range(rdm_scale_min, rdm_scale_max);
|
||||
transform.localScale = new Vector3(scale, scale, 1f);
|
||||
|
||||
float vy = jump_force;
|
||||
float gravity = this_prefab_gravity;
|
||||
float fadeDelay = Mathf.Max(0f, fadeout_awaitTime);
|
||||
float fadeDuration = Mathf.Max(0.0001f, fadeout_time);
|
||||
float totalDuration = Mathf.Max(0.01f, fadeDelay + fadeDuration);
|
||||
|
||||
float t = 0f;
|
||||
while (t < fadeDelay + fadeDuration)
|
||||
while (t < totalDuration)
|
||||
{
|
||||
float dt = Time.deltaTime;
|
||||
vy += gravity * dt;
|
||||
float normalized = Mathf.Clamp01(t / totalDuration);
|
||||
float x = EvaluateCurve(horizontalMotionCurve, normalized) * horizontalDistance;
|
||||
float y = EvaluateCurve(verticalMotionCurve, normalized) * verticalDistance;
|
||||
|
||||
if (useAnchored)
|
||||
{
|
||||
var p = _rectTransform.anchoredPosition;
|
||||
p.y += vy * dt;
|
||||
_rectTransform.anchoredPosition = p;
|
||||
_rectTransform.anchoredPosition = startAnchoredPos + spawnOffset + new Vector2(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
var p = transform.localPosition;
|
||||
p.y += vy * dt;
|
||||
transform.localPosition = p;
|
||||
transform.localPosition = startLocalPos + new Vector3(spawnOffset.x + x, spawnOffset.y + y, 0f);
|
||||
}
|
||||
|
||||
if (t >= fadeDelay)
|
||||
@@ -197,10 +216,35 @@ public class playerInstantNumbersPrefab : MonoBehaviour
|
||||
yield return null;
|
||||
}
|
||||
|
||||
float finalX = EvaluateCurve(horizontalMotionCurve, 1f) * horizontalDistance;
|
||||
float finalY = EvaluateCurve(verticalMotionCurve, 1f) * verticalDistance;
|
||||
if (useAnchored)
|
||||
{
|
||||
_rectTransform.anchoredPosition = startAnchoredPos + spawnOffset + new Vector2(finalX, finalY);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localPosition = startLocalPos + new Vector3(spawnOffset.x + finalX, spawnOffset.y + finalY, 0f);
|
||||
}
|
||||
if (_canvasGroup != null)
|
||||
{
|
||||
_canvasGroup.alpha = 0f;
|
||||
}
|
||||
|
||||
_animationCoroutine = null;
|
||||
if (!iNumberPrefabController.ReturnInstance(this))
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private static float EvaluateCurve(AnimationCurve curve, float time)
|
||||
{
|
||||
if (curve == null || curve.length == 0)
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
return curve.Evaluate(time);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user