Fixes
This commit is contained in:
@@ -28,7 +28,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 462542572961419874}
|
m_GameObject: {fileID: 462542572961419874}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
|
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 1}
|
m_LocalPosition: {x: 0, y: 1.25, z: 1}
|
||||||
m_LocalScale: {x: 1.5000024, y: 1.5000033, z: 1.5000024}
|
m_LocalScale: {x: 1.5000024, y: 1.5000033, z: 1.5000024}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
@@ -4947,6 +4947,8 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 7058331355936229169}
|
- component: {fileID: 7058331355936229169}
|
||||||
|
- component: {fileID: 1024337125332675931}
|
||||||
|
- component: {fileID: -42539312977873233}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: DemonShield
|
m_Name: DemonShield
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -4975,6 +4977,56 @@ Transform:
|
|||||||
- {fileID: 3950270626124424465}
|
- {fileID: 3950270626124424465}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 87.195, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 87.195, z: 0}
|
||||||
|
--- !u!136 &1024337125332675931
|
||||||
|
CapsuleCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4089514887418515818}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 2
|
||||||
|
m_Height: 2
|
||||||
|
m_Direction: 1
|
||||||
|
m_Center: {x: 0, y: 1.25, z: 0}
|
||||||
|
--- !u!54 &-42539312977873233
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4089514887418515818}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Mass: 1000
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||||
|
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||||
|
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ImplicitCom: 1
|
||||||
|
m_ImplicitTensor: 1
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 1
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 0
|
||||||
--- !u!1 &5185508652979790054
|
--- !u!1 &5185508652979790054
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -14637,7 +14689,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 1.25
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
@@ -14738,7 +14790,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 1.25
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
@@ -14835,7 +14887,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 1.25
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
- target: {fileID: 4855141465030352, guid: 5b389d585d7681948a86765d14232bdb, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ GameObject:
|
|||||||
- component: {fileID: 4577187839491108}
|
- component: {fileID: 4577187839491108}
|
||||||
- component: {fileID: 198086061384069858}
|
- component: {fileID: 198086061384069858}
|
||||||
- component: {fileID: 199127982807948490}
|
- component: {fileID: 199127982807948490}
|
||||||
m_Layer: 0
|
m_Layer: 2
|
||||||
m_Name: FireEmbers (4)
|
m_Name: FireEmbers (4)
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
@@ -4703,7 +4703,6 @@ ParticleSystemRenderer:
|
|||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: 776677ab3818fb249adaca05f4e04545, type: 2}
|
- {fileID: 2100000, guid: 776677ab3818fb249adaca05f4e04545, type: 2}
|
||||||
- {fileID: 0}
|
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@@ -4786,7 +4785,7 @@ Transform:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: 6.67, y: 1, z: -53.73}
|
m_LocalPosition: {x: 6.67, y: 1, z: -53.73}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 0.25, y: 0.25, z: 0.25}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4577187839491108}
|
- {fileID: 4577187839491108}
|
||||||
@@ -9552,7 +9551,6 @@ ParticleSystemRenderer:
|
|||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: 3349fc02d104e2b458470ec533f51c16, type: 2}
|
- {fileID: 2100000, guid: 3349fc02d104e2b458470ec533f51c16, type: 2}
|
||||||
- {fileID: 0}
|
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@@ -9625,9 +9623,9 @@ CapsuleCollider:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Radius: 0.5
|
m_Radius: 0.5
|
||||||
m_Height: 1
|
m_Height: 0.1
|
||||||
m_Direction: 1
|
m_Direction: 1
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0.31801516, y: 0, z: 0}
|
||||||
--- !u!114 &6785567375430979834
|
--- !u!114 &6785567375430979834
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -9644,7 +9642,14 @@ MonoBehaviour:
|
|||||||
damageOnce: 1
|
damageOnce: 1
|
||||||
targetLayerMask:
|
targetLayerMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 1410334711
|
m_Bits: 256
|
||||||
|
enableHoming: 1
|
||||||
|
homingStrength: 1.5
|
||||||
|
maxHomingDistance: 15
|
||||||
|
homingDuration: 3
|
||||||
|
continueAfterHoming: 1
|
||||||
|
fireballSpeed: 10
|
||||||
|
maxTurnRate: 90
|
||||||
impactEffectPrefab: {fileID: 132858, guid: c5cabec71c815b64ab6e2547b594ec81, type: 3}
|
impactEffectPrefab: {fileID: 132858, guid: c5cabec71c815b64ab6e2547b594ec81, type: 3}
|
||||||
impactSound: {fileID: 8300000, guid: 5dd60193d2ea89e47ae309eec2c3852e, type: 3}
|
impactSound: {fileID: 8300000, guid: 5dd60193d2ea89e47ae309eec2c3852e, type: 3}
|
||||||
knockbackForce: 5
|
knockbackForce: 5
|
||||||
@@ -9654,3 +9659,4 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 1
|
m_Bits: 1
|
||||||
enableDebug: 0
|
enableDebug: 0
|
||||||
|
showGizmos: 1
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace DemonBoss.Magic
|
|||||||
/// StateAction for Magic Shield spell - boss casts magical shield for 5 seconds
|
/// StateAction for Magic Shield spell - boss casts magical shield for 5 seconds
|
||||||
/// During casting boss stands still, after completion returns to Combat
|
/// During casting boss stands still, after completion returns to Combat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[CreateAssetMenu(menuName = "Invector/FSM/Decisions/DemonBoss/Cast Shield")]
|
[CreateAssetMenu(menuName = "Invector/FSM/Actions/DemonBoss/Cast Shield")]
|
||||||
public class SA_CastShield : vStateAction
|
public class SA_CastShield : vStateAction
|
||||||
{
|
{
|
||||||
public override string categoryName => "DemonBoss/Magic";
|
public override string categoryName => "DemonBoss/Magic";
|
||||||
@@ -18,21 +18,19 @@ namespace DemonBoss.Magic
|
|||||||
[Tooltip("Prefab with magical shield particle effect")]
|
[Tooltip("Prefab with magical shield particle effect")]
|
||||||
public GameObject shieldFXPrefab;
|
public GameObject shieldFXPrefab;
|
||||||
|
|
||||||
[Tooltip("Transform where shield should appear (usually boss center)")]
|
|
||||||
public Transform shieldSpawnPoint;
|
|
||||||
|
|
||||||
[Tooltip("Shield duration in seconds")]
|
[Tooltip("Shield duration in seconds")]
|
||||||
public float shieldDuration = 5f;
|
public float shieldDuration = 5f;
|
||||||
|
|
||||||
[Tooltip("Animator trigger name for shield casting animation")]
|
[Tooltip("Animator bool parameter name for blocking state")]
|
||||||
public string animatorTrigger = "CastShield";
|
public string animatorBlockingBool = "IsBlocking";
|
||||||
|
|
||||||
[Header("Debug")]
|
[Header("Debug")]
|
||||||
[Tooltip("Enable debug logging")]
|
[Tooltip("Enable debug logging")]
|
||||||
public bool enableDebug = false;
|
public bool enableDebug = false;
|
||||||
|
|
||||||
private GameObject spawnedShield;
|
private GameObject spawnedShield;
|
||||||
|
private Animator npcAnimator;
|
||||||
|
private Transform npcTransform;
|
||||||
private float shieldStartTime;
|
private float shieldStartTime;
|
||||||
private bool shieldActive = false;
|
private bool shieldActive = false;
|
||||||
|
|
||||||
@@ -62,6 +60,10 @@ namespace DemonBoss.Magic
|
|||||||
{
|
{
|
||||||
if (enableDebug) Debug.Log("[SA_CastShield] Entering shield casting state");
|
if (enableDebug) Debug.Log("[SA_CastShield] Entering shield casting state");
|
||||||
|
|
||||||
|
// Store NPC references
|
||||||
|
npcTransform = fsmBehaviour.transform;
|
||||||
|
npcAnimator = npcTransform.GetComponent<Animator>();
|
||||||
|
|
||||||
var aiController = fsmBehaviour as Invector.vCharacterController.AI.vIControlAI;
|
var aiController = fsmBehaviour as Invector.vCharacterController.AI.vIControlAI;
|
||||||
if (aiController != null)
|
if (aiController != null)
|
||||||
{
|
{
|
||||||
@@ -69,11 +71,10 @@ namespace DemonBoss.Magic
|
|||||||
if (enableDebug) Debug.Log("[SA_CastShield] AI stopped");
|
if (enableDebug) Debug.Log("[SA_CastShield] AI stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
var animator = fsmBehaviour.transform.GetComponent<Animator>();
|
if (npcAnimator != null && !string.IsNullOrEmpty(animatorBlockingBool))
|
||||||
if (animator != null && !string.IsNullOrEmpty(animatorTrigger))
|
|
||||||
{
|
{
|
||||||
animator.SetTrigger(animatorTrigger);
|
npcAnimator.SetBool(animatorBlockingBool, true);
|
||||||
if (enableDebug) Debug.Log($"[SA_CastShield] Set trigger: {animatorTrigger}");
|
if (enableDebug) Debug.Log($"[SA_CastShield] Set bool: {animatorBlockingBool} = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnShieldEffect(fsmBehaviour);
|
SpawnShieldEffect(fsmBehaviour);
|
||||||
@@ -101,6 +102,12 @@ namespace DemonBoss.Magic
|
|||||||
{
|
{
|
||||||
if (enableDebug) Debug.Log("[SA_CastShield] Exiting shield state");
|
if (enableDebug) Debug.Log("[SA_CastShield] Exiting shield state");
|
||||||
|
|
||||||
|
if (npcAnimator != null && !string.IsNullOrEmpty(animatorBlockingBool))
|
||||||
|
{
|
||||||
|
npcAnimator.SetBool(animatorBlockingBool, false);
|
||||||
|
if (enableDebug) Debug.Log($"[SA_CastShield] Set bool: {animatorBlockingBool} = false");
|
||||||
|
}
|
||||||
|
|
||||||
if (shieldActive)
|
if (shieldActive)
|
||||||
{
|
{
|
||||||
CleanupShield();
|
CleanupShield();
|
||||||
@@ -124,17 +131,18 @@ namespace DemonBoss.Magic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 spawnPosition = shieldSpawnPoint != null ?
|
// Spawn shield at NPC's position and rotation
|
||||||
shieldSpawnPoint.position : fsmBehaviour.transform.position;
|
Vector3 spawnPosition = npcTransform.position;
|
||||||
|
Quaternion spawnRotation = npcTransform.rotation;
|
||||||
|
|
||||||
spawnedShield = LeanPool.Spawn(shieldFXPrefab, spawnPosition,
|
spawnedShield = LeanPool.Spawn(shieldFXPrefab, spawnPosition, spawnRotation);
|
||||||
shieldSpawnPoint != null ? shieldSpawnPoint.rotation : fsmBehaviour.transform.rotation);
|
|
||||||
|
|
||||||
if (enableDebug) Debug.Log($"[SA_CastShield] Shield spawned at position: {spawnPosition}");
|
if (enableDebug) Debug.Log($"[SA_CastShield] Shield spawned at NPC position: {spawnPosition}");
|
||||||
|
|
||||||
if (spawnedShield != null && shieldSpawnPoint != null)
|
// Parent the shield to the NPC so it moves with them
|
||||||
|
if (spawnedShield != null)
|
||||||
{
|
{
|
||||||
spawnedShield.transform.SetParent(shieldSpawnPoint);
|
spawnedShield.transform.SetParent(npcTransform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ namespace DemonBoss.Magic
|
|||||||
[Tooltip("Layer mask for ground")]
|
[Tooltip("Layer mask for ground")]
|
||||||
public LayerMask groundLayerMask = -1;
|
public LayerMask groundLayerMask = -1;
|
||||||
|
|
||||||
[Tooltip("Animator trigger name for crystal casting animation")]
|
[Tooltip("Animator bool parameter name for blocking state")]
|
||||||
public string animatorTrigger = "CastCrystal";
|
public string animatorBlockingBool = "IsBlocking";
|
||||||
|
|
||||||
[Header("Smart Positioning")]
|
[Header("Smart Positioning")]
|
||||||
[Tooltip("Preference multiplier for positions behind boss (relative to player)")]
|
[Tooltip("Preference multiplier for positions behind boss (relative to player)")]
|
||||||
@@ -54,7 +54,8 @@ namespace DemonBoss.Magic
|
|||||||
public bool showGizmos = true;
|
public bool showGizmos = true;
|
||||||
|
|
||||||
private GameObject spawnedCrystal;
|
private GameObject spawnedCrystal;
|
||||||
|
private Animator npcAnimator;
|
||||||
|
private Transform npcTransform;
|
||||||
private Transform playerTransform;
|
private Transform playerTransform;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,6 +67,10 @@ namespace DemonBoss.Magic
|
|||||||
{
|
{
|
||||||
OnStateEnter(fsmBehaviour);
|
OnStateEnter(fsmBehaviour);
|
||||||
}
|
}
|
||||||
|
else if (executionType == vFSMComponentExecutionType.OnStateExit)
|
||||||
|
{
|
||||||
|
OnStateExit(fsmBehaviour);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -75,13 +80,16 @@ namespace DemonBoss.Magic
|
|||||||
{
|
{
|
||||||
if (enableDebug) Debug.Log("[SA_SpawnTurretSmart] Starting intelligent crystal spawn");
|
if (enableDebug) Debug.Log("[SA_SpawnTurretSmart] Starting intelligent crystal spawn");
|
||||||
|
|
||||||
|
// Store NPC references
|
||||||
|
npcTransform = fsmBehaviour.transform;
|
||||||
|
npcAnimator = npcTransform.GetComponent<Animator>();
|
||||||
|
|
||||||
FindPlayer(fsmBehaviour);
|
FindPlayer(fsmBehaviour);
|
||||||
|
|
||||||
var animator = fsmBehaviour.transform.GetComponent<Animator>();
|
if (npcAnimator != null && !string.IsNullOrEmpty(animatorBlockingBool))
|
||||||
if (animator != null && !string.IsNullOrEmpty(animatorTrigger))
|
|
||||||
{
|
{
|
||||||
animator.SetTrigger(animatorTrigger);
|
npcAnimator.SetBool(animatorBlockingBool, true);
|
||||||
if (enableDebug) Debug.Log($"[SA_SpawnTurretSmart] Set trigger: {animatorTrigger}");
|
if (enableDebug) Debug.Log($"[SA_SpawnTurretSmart] Set bool: {animatorBlockingBool} = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnCrystalSmart(fsmBehaviour);
|
SpawnCrystalSmart(fsmBehaviour);
|
||||||
@@ -89,6 +97,20 @@ namespace DemonBoss.Magic
|
|||||||
DEC_CheckCooldown.SetCooldownStatic(fsmBehaviour, "Turret", 12f);
|
DEC_CheckCooldown.SetCooldownStatic(fsmBehaviour, "Turret", 12f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when exiting state - cleanup
|
||||||
|
/// </summary>
|
||||||
|
private void OnStateExit(vIFSMBehaviourController fsmBehaviour)
|
||||||
|
{
|
||||||
|
if (enableDebug) Debug.Log("[SA_SpawnTurretSmart] Exiting turret spawn state");
|
||||||
|
|
||||||
|
if (npcAnimator != null && !string.IsNullOrEmpty(animatorBlockingBool))
|
||||||
|
{
|
||||||
|
npcAnimator.SetBool(animatorBlockingBool, false);
|
||||||
|
if (enableDebug) Debug.Log($"[SA_SpawnTurretSmart] Set bool: {animatorBlockingBool} = false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds player transform
|
/// Finds player transform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -128,7 +150,7 @@ namespace DemonBoss.Magic
|
|||||||
bool foundValidPosition = false;
|
bool foundValidPosition = false;
|
||||||
float bestScore = float.MinValue;
|
float bestScore = float.MinValue;
|
||||||
|
|
||||||
Vector3 bossPos = fsmBehaviour.transform.position;
|
Vector3 bossPos = npcTransform.position;
|
||||||
Vector3 playerDirection = Vector3.zero;
|
Vector3 playerDirection = Vector3.zero;
|
||||||
|
|
||||||
if (playerTransform != null)
|
if (playerTransform != null)
|
||||||
@@ -146,7 +168,7 @@ namespace DemonBoss.Magic
|
|||||||
|
|
||||||
if (IsPositionValid(testPosition, out Vector3 groundPosition))
|
if (IsPositionValid(testPosition, out Vector3 groundPosition))
|
||||||
{
|
{
|
||||||
float score = EvaluatePosition(groundPosition, playerDirection, direction);
|
float score = EvaluatePosition(groundPosition, playerDirection, direction, bossPos);
|
||||||
|
|
||||||
if (score > bestScore)
|
if (score > bestScore)
|
||||||
{
|
{
|
||||||
@@ -164,7 +186,7 @@ namespace DemonBoss.Magic
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Vector3 fallbackPos = bossPos + fsmBehaviour.transform.forward * minSpawnDistance;
|
Vector3 fallbackPos = bossPos + npcTransform.forward * minSpawnDistance;
|
||||||
SpawnCrystal(fallbackPos, fsmBehaviour);
|
SpawnCrystal(fallbackPos, fsmBehaviour);
|
||||||
if (enableDebug) Debug.LogWarning("[SA_SpawnTurretSmart] Using fallback position");
|
if (enableDebug) Debug.LogWarning("[SA_SpawnTurretSmart] Using fallback position");
|
||||||
}
|
}
|
||||||
@@ -201,7 +223,7 @@ namespace DemonBoss.Magic
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Evaluates position quality (higher score = better position)
|
/// Evaluates position quality (higher score = better position)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float EvaluatePosition(Vector3 position, Vector3 playerDirection, Vector3 positionDirection)
|
private float EvaluatePosition(Vector3 position, Vector3 playerDirection, Vector3 positionDirection, Vector3 bossPos)
|
||||||
{
|
{
|
||||||
float score = 0f;
|
float score = 0f;
|
||||||
|
|
||||||
@@ -214,7 +236,6 @@ namespace DemonBoss.Magic
|
|||||||
score += backScore * backPreferenceMultiplier;
|
score += backScore * backPreferenceMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 bossPos = new Vector3();
|
|
||||||
float distance = Vector3.Distance(position, bossPos);
|
float distance = Vector3.Distance(position, bossPos);
|
||||||
float optimalDistance = (minSpawnDistance + maxSpawnDistance) * 0.5f;
|
float optimalDistance = (minSpawnDistance + maxSpawnDistance) * 0.5f;
|
||||||
float distanceScore = 1f - Mathf.Abs(distance - optimalDistance) / maxSpawnDistance;
|
float distanceScore = 1f - Mathf.Abs(distance - optimalDistance) / maxSpawnDistance;
|
||||||
@@ -264,17 +285,20 @@ namespace DemonBoss.Magic
|
|||||||
{
|
{
|
||||||
if (!showGizmos) return;
|
if (!showGizmos) return;
|
||||||
|
|
||||||
Vector3 pos = new Vector3();
|
if (npcTransform != null)
|
||||||
|
{
|
||||||
|
Vector3 pos = npcTransform.position;
|
||||||
|
|
||||||
// Spawn ring
|
// Spawn ring
|
||||||
Gizmos.color = Color.green;
|
Gizmos.color = Color.green;
|
||||||
DrawWireCircle(pos, minSpawnDistance);
|
DrawWireCircle(pos, minSpawnDistance);
|
||||||
Gizmos.color = Color.red;
|
Gizmos.color = Color.red;
|
||||||
DrawWireCircle(pos, maxSpawnDistance);
|
DrawWireCircle(pos, maxSpawnDistance);
|
||||||
|
|
||||||
// Obstacle check radius
|
// Obstacle check radius
|
||||||
Gizmos.color = Color.yellow;
|
Gizmos.color = Color.yellow;
|
||||||
Gizmos.DrawWireSphere(pos + Vector3.up * obstacleCheckRadius, obstacleCheckRadius);
|
Gizmos.DrawWireSphere(pos + Vector3.up * obstacleCheckRadius, obstacleCheckRadius);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ GameObject:
|
|||||||
- component: {fileID: 2323612}
|
- component: {fileID: 2323612}
|
||||||
- component: {fileID: 13662188}
|
- component: {fileID: 13662188}
|
||||||
- component: {fileID: 7020133711031364094}
|
- component: {fileID: 7020133711031364094}
|
||||||
m_Layer: 0
|
m_Layer: 26
|
||||||
m_Name: Turet
|
m_Name: Turet
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
@@ -32,7 +32,8 @@ Transform:
|
|||||||
m_LocalPosition: {x: -3.8250632, y: -7.1673625e-17, z: 3.2278929}
|
m_LocalPosition: {x: -3.8250632, y: -7.1673625e-17, z: 3.2278929}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: 8411050209285398990}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!33 &3365858
|
--- !u!33 &3365858
|
||||||
@@ -123,7 +124,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 906d915677721914dbe9708f218f574a, type: 3}
|
m_Script: {fileID: 11500000, guid: 906d915677721914dbe9708f218f574a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
muzzle: {fileID: 417168}
|
muzzle: {fileID: 8411050209285398990}
|
||||||
fireballPrefab: {fileID: 1947871717301538, guid: 9591667a35466484096c6e63785e136c,
|
fireballPrefab: {fileID: 1947871717301538, guid: 9591667a35466484096c6e63785e136c,
|
||||||
type: 3}
|
type: 3}
|
||||||
fireballSpeed: 28
|
fireballSpeed: 28
|
||||||
@@ -140,3 +141,34 @@ MonoBehaviour:
|
|||||||
shootSound: {fileID: 8300000, guid: d44a96f293b66b74ea13a2e6fcc6c8fa, type: 3}
|
shootSound: {fileID: 8300000, guid: d44a96f293b66b74ea13a2e6fcc6c8fa, type: 3}
|
||||||
enableDebug: 0
|
enableDebug: 0
|
||||||
showGizmos: 1
|
showGizmos: 1
|
||||||
|
--- !u!1 &6534933121460188189
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8411050209285398990}
|
||||||
|
m_Layer: 26
|
||||||
|
m_Name: Spawnpoint
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8411050209285398990
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6534933121460188189}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 3.114, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 417168}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user