Merge branch 'main' of https://homelab.tailf7f81b.ts.net/tschesky/AppleHillsProduction
This commit is contained in:
@@ -14,7 +14,7 @@ GameObject:
|
|||||||
- component: {fileID: 2121127948713986199}
|
- component: {fileID: 2121127948713986199}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Pulver
|
m_Name: Pulver
|
||||||
m_TagString: Untagged
|
m_TagString: CharacterArt
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ GameObject:
|
|||||||
- component: {fileID: 3714001194702331617}
|
- component: {fileID: 3714001194702331617}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Trafalgar
|
m_Name: Trafalgar
|
||||||
m_TagString: Untagged
|
m_TagString: CharacterArt
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Pathfinding {
|
|||||||
const double updateCheckRate = 1F;
|
const double updateCheckRate = 1F;
|
||||||
|
|
||||||
/// <summary>URL to the version file containing the latest version number.</summary>
|
/// <summary>URL to the version file containing the latest version number.</summary>
|
||||||
const string updateURL = "http://www.arongranberg.com/astar/version.php";
|
const string updateURL = "https://www.arongranberg.com/astar/version.php";
|
||||||
|
|
||||||
/// <summary>Last time an update check was made</summary>
|
/// <summary>Last time an update check was made</summary>
|
||||||
public static System.DateTime lastUpdateCheck {
|
public static System.DateTime lastUpdateCheck {
|
||||||
|
|||||||
@@ -28,9 +28,22 @@ public class FollowerController : MonoBehaviour
|
|||||||
public float stopThreshold = 0.1f; // Stop moving when within this distance
|
public float stopThreshold = 0.1f; // Stop moving when within this distance
|
||||||
private float playerMaxSpeed = 5f;
|
private float playerMaxSpeed = 5f;
|
||||||
|
|
||||||
|
private Animator animator;
|
||||||
|
private Transform artTransform;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
aiPath = GetComponent<AIPath>();
|
aiPath = GetComponent<AIPath>();
|
||||||
|
// Find art prefab and animator
|
||||||
|
artTransform = transform.Find("CharacterArt");
|
||||||
|
if (artTransform != null)
|
||||||
|
{
|
||||||
|
animator = artTransform.GetComponent<Animator>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
animator = GetComponentInChildren<Animator>(); // fallback
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
@@ -155,6 +168,23 @@ public class FollowerController : MonoBehaviour
|
|||||||
currentSpeed = 0f;
|
currentSpeed = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update animator speed parameter
|
||||||
|
if (animator != null)
|
||||||
|
{
|
||||||
|
float normalizedSpeed = 0f;
|
||||||
|
if (isManualFollowing)
|
||||||
|
{
|
||||||
|
// Use currentSpeed for manual following
|
||||||
|
normalizedSpeed = currentSpeed / playerMaxSpeed;
|
||||||
|
}
|
||||||
|
else if (aiPath != null)
|
||||||
|
{
|
||||||
|
// Use aiPath velocity for pathfinding mode
|
||||||
|
normalizedSpeed = aiPath.velocity.magnitude / playerMaxSpeed;
|
||||||
|
}
|
||||||
|
animator.SetFloat("Speed", Mathf.Clamp01(normalizedSpeed));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command follower to go to a specific point (pathfinding mode)
|
// Command follower to go to a specific point (pathfinding mode)
|
||||||
|
|||||||
@@ -18,12 +18,24 @@ public class PlayerTouchController : MonoBehaviour, ITouchInputConsumer
|
|||||||
Rigidbody rb3d;
|
Rigidbody rb3d;
|
||||||
Rigidbody2D rb2d;
|
Rigidbody2D rb2d;
|
||||||
AIPath aiPath; // Reference to AIPath
|
AIPath aiPath; // Reference to AIPath
|
||||||
|
private Animator animator;
|
||||||
|
private Transform artTransform;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
rb3d = GetComponent<Rigidbody>();
|
rb3d = GetComponent<Rigidbody>();
|
||||||
rb2d = GetComponent<Rigidbody2D>();
|
rb2d = GetComponent<Rigidbody2D>();
|
||||||
aiPath = GetComponent<AIPath>(); // Get AIPath component
|
aiPath = GetComponent<AIPath>(); // Get AIPath component
|
||||||
|
// Find art prefab and animator
|
||||||
|
artTransform = transform.Find("CharacterArt");
|
||||||
|
if (artTransform != null)
|
||||||
|
{
|
||||||
|
animator = artTransform.GetComponent<Animator>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
animator = GetComponentInChildren<Animator>(); // fallback
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@@ -70,5 +82,15 @@ public class PlayerTouchController : MonoBehaviour, ITouchInputConsumer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
// Update animator speed parameter
|
||||||
|
if (animator != null && aiPath != null)
|
||||||
|
{
|
||||||
|
float normalizedSpeed = aiPath.velocity.magnitude / aiPath.maxSpeed;
|
||||||
|
animator.SetFloat("Speed", Mathf.Clamp01(normalizedSpeed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove FixedUpdate and MoveTowardsTarget, as AIPath handles movement
|
// Remove FixedUpdate and MoveTowardsTarget, as AIPath handles movement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
--- !u!78 &1
|
--- !u!78 &1
|
||||||
TagManager:
|
TagManager:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
tags: []
|
tags:
|
||||||
|
- CharacterArt
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user