First project upload
This commit is contained in:
@@ -467,7 +467,10 @@ public class CashSystemManager : MonoBehaviour
|
||||
// The old code loaded "Enemy" prefabs which caused confusion
|
||||
// Now we use ONE prefab per character and configure it based on team
|
||||
GameObject prefab = CharacterPrefabManager.Instance.GetCharacterPrefab(characterName, isAI: false);
|
||||
|
||||
|
||||
//bool isAI = !isPlayerControlled;
|
||||
//GameObject prefab = CharacterPrefabManager.Instance.GetCharacterPrefab(characterName, isAI);
|
||||
|
||||
if (prefab == null)
|
||||
{
|
||||
Debug.LogError($"[CashSystemManager] Failed to load prefab for {characterName}");
|
||||
@@ -532,7 +535,7 @@ public class CashSystemManager : MonoBehaviour
|
||||
|
||||
// Set team based on tag
|
||||
bool isPlayerTeam = (teamTag == "Player");
|
||||
teamMember.CurrentTeam = isPlayerTeam ? TeamMember.Team.PlayerTeam : TeamMember.Team.EnemyTeam;
|
||||
teamMember.CurrentTeam = isPlayerTeam ? TeamMember.Team.PlayerTeam : TeamMember.Team.EnemyTeam1;
|
||||
|
||||
// Set proper tag (TeamMember.UpdateLayerAndTag will handle this but we set it here too)
|
||||
character.tag = teamTag;
|
||||
@@ -561,10 +564,10 @@ public class CashSystemManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Add CashCarrier for carrying cash
|
||||
if (character.GetComponent<CashCarrier>() == null)
|
||||
{
|
||||
character.AddComponent<CashCarrier>();
|
||||
}
|
||||
//if (character.GetComponent<CashCarrier>() == null)
|
||||
//{
|
||||
// character.AddComponent<CashCarrier>();
|
||||
//}
|
||||
|
||||
// Register with TeamControlManager for switching
|
||||
if (TeamControlManager.Instance != null && isPlayerTeam)
|
||||
@@ -706,11 +709,11 @@ public class CashSystemManager : MonoBehaviour
|
||||
if (inputHandler != null) inputHandler.enabled = false;
|
||||
|
||||
// Enable CharacterAIController if present, or add it
|
||||
if (aiController == null)
|
||||
{
|
||||
aiController = character.AddComponent<CharacterAIController>();
|
||||
}
|
||||
aiController.enabled = true;
|
||||
//if (aiController == null)
|
||||
//{
|
||||
// aiController = character.AddComponent<CharacterAIController>();
|
||||
//}
|
||||
//aiController.enabled = true;
|
||||
|
||||
// CRITICAL: Disable PlayerInput on AI characters to prevent duplicate input
|
||||
PlayerInput playerInput = character.GetComponent<PlayerInput>();
|
||||
@@ -744,20 +747,20 @@ public class CashSystemManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Add EnemyAIController if not present
|
||||
EnemyAIController enemyAI = character.GetComponent<EnemyAIController>();
|
||||
if (enemyAI == null)
|
||||
{
|
||||
enemyAI = character.AddComponent<EnemyAIController>();
|
||||
}
|
||||
enemyAI.enabled = true;
|
||||
//EnemyAIController enemyAI = character.GetComponent<EnemyAIController>();
|
||||
//if (enemyAI == null)
|
||||
//{
|
||||
// enemyAI = character.AddComponent<EnemyAIController>();
|
||||
//}
|
||||
//enemyAI.enabled = true;
|
||||
|
||||
// Add CashSystemAI for cash-related decisions
|
||||
CashSystemAI cashAI = character.GetComponent<CashSystemAI>();
|
||||
if (cashAI == null)
|
||||
{
|
||||
cashAI = character.AddComponent<CashSystemAI>();
|
||||
}
|
||||
cashAI.enabled = true;
|
||||
//CashSystemAI cashAI = character.GetComponent<CashSystemAI>();
|
||||
//if (cashAI == null)
|
||||
//{
|
||||
// cashAI = character.AddComponent<CashSystemAI>();
|
||||
//}
|
||||
//cashAI.enabled = true;
|
||||
|
||||
// Keep NavMeshAgent for movement
|
||||
UnityEngine.AI.NavMeshAgent navAgent = character.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
|
||||
Reference in New Issue
Block a user