chore: remove Unity AI Toolkit packages to fix enum warnings
- Remove com.unity.ai.assistant, com.unity.ai.generators, com.unity.ai.inference - Update packages-lock.json - Additional Phase 19 visual polish updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ namespace TheIsland
|
||||
public float moveBopAmount = 0.1f;
|
||||
public float moveTiltAmount = 10f;
|
||||
public float bankingAmount = 15f;
|
||||
public float jiggleIntensity = 0.15f;
|
||||
|
||||
private SpriteRenderer _spriteRenderer;
|
||||
private Vector3 _originalScale;
|
||||
@@ -27,7 +28,8 @@ namespace TheIsland
|
||||
private Vector3 _currentVelocity;
|
||||
private float _velocityPercentage; // 0 to 1
|
||||
private bool _isMoving;
|
||||
private float _transitionTimer;
|
||||
private float _jiggleOffset;
|
||||
private float _jiggleVelocity;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -50,20 +52,21 @@ namespace TheIsland
|
||||
public void SetMovement(Vector3 velocity, float maxVelocity = 3f)
|
||||
{
|
||||
_currentVelocity = velocity;
|
||||
_velocityPercentage = Mathf.Clamp01(velocity.magnitude / Mathf.Max(0.1f, maxVelocity));
|
||||
float targetVelPct = Mathf.Clamp01(velocity.magnitude / Mathf.Max(0.1f, maxVelocity));
|
||||
|
||||
bool nowMoving = _velocityPercentage > 0.05f;
|
||||
bool nowMoving = targetVelPct > 0.05f;
|
||||
if (nowMoving && !_isMoving)
|
||||
{
|
||||
// Anticipation: Squash when starting to move
|
||||
TriggerAnticipation();
|
||||
_jiggleVelocity = -2f; // Initial kickback
|
||||
}
|
||||
else if (!nowMoving && _isMoving)
|
||||
{
|
||||
// Overshoot: Rebound when stopping
|
||||
TriggerOvershoot();
|
||||
_jiggleVelocity = 2f; // Snap forward
|
||||
}
|
||||
|
||||
_velocityPercentage = targetVelPct;
|
||||
_isMoving = nowMoving;
|
||||
}
|
||||
|
||||
@@ -93,6 +96,14 @@ namespace TheIsland
|
||||
{
|
||||
if (_spriteRenderer == null) return;
|
||||
|
||||
// Phase 19-F: Secondary Jiggle Physics (Simple Spring)
|
||||
float jiggleStrength = 150f;
|
||||
float jiggleDamping = 10f;
|
||||
float force = -jiggleStrength * _jiggleOffset;
|
||||
_jiggleVelocity += (force * Time.deltaTime);
|
||||
_jiggleVelocity -= _jiggleVelocity * jiggleDamping * Time.deltaTime;
|
||||
_jiggleOffset += _jiggleVelocity * Time.deltaTime;
|
||||
|
||||
if (_isMoving)
|
||||
{
|
||||
AnimateMove();
|
||||
@@ -105,9 +116,12 @@ namespace TheIsland
|
||||
// Smoothly apply transforms
|
||||
float lerpSpeed = 12f;
|
||||
var t = _spriteRenderer.transform;
|
||||
t.localPosition = Vector3.Lerp(t.localPosition, _targetLocalPos, Time.deltaTime * lerpSpeed);
|
||||
t.localRotation = Quaternion.Slerp(t.localRotation, _targetLocalRot, Time.deltaTime * lerpSpeed);
|
||||
t.localScale = Vector3.Lerp(t.localScale, _targetScale, Time.deltaTime * lerpSpeed);
|
||||
t.localPosition = Vector3.Lerp(t.localPosition, _targetLocalPos + new Vector3(0, _jiggleOffset * 0.1f, 0), Time.deltaTime * lerpSpeed);
|
||||
t.localRotation = Quaternion.Slerp(t.localRotation, _targetLocalRot * Quaternion.Euler(0, 0, _jiggleOffset * 2f), Time.deltaTime * lerpSpeed);
|
||||
|
||||
// Apply scale with jiggle squash/stretch
|
||||
Vector3 jiggleScale = new Vector3(1f + _jiggleOffset, 1f - _jiggleOffset, 1f);
|
||||
t.localScale = Vector3.Lerp(t.localScale, Vector3.Scale(_targetScale, jiggleScale), Time.deltaTime * lerpSpeed);
|
||||
}
|
||||
|
||||
private void AnimateIdle()
|
||||
|
||||
@@ -222,6 +222,55 @@ namespace TheIsland.Visual
|
||||
return Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
public void SpawnFootstepDust(Vector3 position)
|
||||
{
|
||||
var dust = new GameObject("FootstepDust");
|
||||
dust.transform.position = position;
|
||||
var sprite = dust.AddComponent<SpriteRenderer>();
|
||||
sprite.sprite = CreateDustSprite();
|
||||
sprite.color = new Color(0.9f, 0.8f, 0.6f, 0.4f);
|
||||
sprite.sortingOrder = 5; // Behind agents usually or just low
|
||||
dust.AddComponent<Billboard>();
|
||||
StartCoroutine(AnimateDust(dust));
|
||||
}
|
||||
|
||||
private Sprite CreateDustSprite()
|
||||
{
|
||||
int size = 16;
|
||||
Texture2D tex = new Texture2D(size, size);
|
||||
for (int y = 0; y < size; y++)
|
||||
{
|
||||
for (int x = 0; x < size; x++)
|
||||
{
|
||||
float d = Vector2.Distance(new Vector2(x, y), new Vector2(size / 2f, size / 2f)) / (size / 2f);
|
||||
float alpha = Mathf.Max(0, 1.0f - d);
|
||||
tex.SetPixel(x, y, new Color(1, 1, 1, alpha * alpha));
|
||||
}
|
||||
}
|
||||
tex.Apply();
|
||||
return Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
private IEnumerator AnimateDust(GameObject dust)
|
||||
{
|
||||
float elapsed = 0;
|
||||
float duration = 0.8f;
|
||||
Vector3 startScale = Vector3.one * 0.2f;
|
||||
Vector3 endScale = Vector3.one * 1.5f;
|
||||
var sprite = dust.GetComponent<SpriteRenderer>();
|
||||
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = elapsed / duration;
|
||||
dust.transform.localScale = Vector3.Lerp(startScale, endScale, t);
|
||||
sprite.color = new Color(0.9f, 0.8f, 0.6f, 0.4f * (1f - t));
|
||||
dust.transform.position += Vector3.up * Time.deltaTime * 0.5f;
|
||||
yield return null;
|
||||
}
|
||||
Destroy(dust);
|
||||
}
|
||||
|
||||
private IEnumerator AnimateFirefly(GameObject firefly)
|
||||
{
|
||||
Vector3 startPos = firefly.transform.position;
|
||||
|
||||
Reference in New Issue
Block a user