From 39290468a297461eaaac62114300cf7b4db821f8 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 21 Dec 2024 14:33:49 +0000 Subject: [PATCH] Allow necros to give minions movement instructions on "A" continuous press --- .../Abilities/BasicMinionPrefab.prefab | 24 ++++++---- .../PlayerMinion/MinionNPCController.cs | 45 +++++++++++++++++-- 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/Assets/Resources/Abilities/BasicMinionPrefab.prefab b/Assets/Resources/Abilities/BasicMinionPrefab.prefab index a0167c4a..64607c37 100644 --- a/Assets/Resources/Abilities/BasicMinionPrefab.prefab +++ b/Assets/Resources/Abilities/BasicMinionPrefab.prefab @@ -4896,7 +4896,7 @@ MonoBehaviour: coinAmount: 2 extraDropChance: 5 onCoinDrop: {fileID: 11400000, guid: 48da3b1185c086c4c81a2b97ab7685fc, type: 2} - guaranteedDrops: [] + guaranteedItemDrop: [] extraDrops: - {fileID: 11400000, guid: 26b042abfe9104448a1e9599be66e71a, type: 2} - {fileID: 11400000, guid: e08687c26614d154cb5a9a01f4b97635, type: 2} @@ -5172,8 +5172,8 @@ MonoBehaviour: projectileRange: 5 meleeRange: 2.5 distanceToChangePatrolDestination: 0.9 - patrolAgentSpeed: 3 - chasingAgentSpeed: 2.5 + patrolAgentSpeed: 5 + chasingAgentSpeed: 3 timeBetweenAttacks: 2 photonView: {fileID: 0} myTag: {fileID: 0} @@ -5189,6 +5189,9 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] experienceOnDeath: {fileID: 11400000, guid: 57959f6a9d7e8ab409d77bd400e80224, type: 2} + movementMask: + serializedVersion: 2 + m_Bits: 8 --- !u!195 &2475434436818348718 NavMeshAgent: m_ObjectHideFlags: 0 @@ -5341,18 +5344,18 @@ MonoBehaviour: Vitality: statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2} BaseValue: 1 - CritChance: - statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2} - BaseValue: 3 - CritDamage: - statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2} - BaseValue: 50 AttackDamage: statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2} BaseValue: 1 SpellDamage: statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2} BaseValue: 1 + CritChance: + statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2} + BaseValue: 3 + CritDamage: + statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2} + BaseValue: 50 MaxHealth: statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2} BaseValue: 0 @@ -5501,6 +5504,7 @@ MonoBehaviour: OnEffectEnded: m_PersistentCalls: m_Calls: [] + mitigationType: 0 currentDamagePerTick: 0 OnEffectTick: m_PersistentCalls: @@ -5528,6 +5532,7 @@ MonoBehaviour: OnEffectEnded: m_PersistentCalls: m_Calls: [] + mitigationType: 0 currentDamagePerTick: 0 OnEffectTick: m_PersistentCalls: @@ -5555,6 +5560,7 @@ MonoBehaviour: OnEffectEnded: m_PersistentCalls: m_Calls: [] + mitigationType: 0 currentDamagePerTick: 0 OnEffectTick: m_PersistentCalls: diff --git a/Assets/Scripts/NPC/NPCControllers_v2/PlayerMinion/MinionNPCController.cs b/Assets/Scripts/NPC/NPCControllers_v2/PlayerMinion/MinionNPCController.cs index 9e91350d..455b17a6 100644 --- a/Assets/Scripts/NPC/NPCControllers_v2/PlayerMinion/MinionNPCController.cs +++ b/Assets/Scripts/NPC/NPCControllers_v2/PlayerMinion/MinionNPCController.cs @@ -7,9 +7,20 @@ public class MinionNPCController : BasicEnemyNPCController { protected bool isReady = false; + public LayerMask movementMask; + + Camera cam; + Plane plane = new Plane(Vector3.down, 0); + Ray ray; + RaycastHit hit; + protected override void Start() { + cam = Camera.main; + base.Start(); + + isReady = false; } @@ -30,13 +41,32 @@ public class MinionNPCController : BasicEnemyNPCController counter += Time.deltaTime; - if (HasTarget()) + if (Input.GetKey(KeyCode.A)) { - ChasingUpdate(); + ray = cam.ScreenPointToRay(Input.mousePosition); + + if (Physics.Raycast(ray, out hit, 100f, movementMask)) + { + FollowInstruction(hit.point); + } + else + { + if (plane.Raycast(ray, out float distance)) + { + FollowInstruction(ray.GetPoint(distance)); + } + } } else { - PatrollingUpdate(); + if (HasTarget()) + { + ChasingUpdate(); + } + else + { + PatrollingUpdate(); + } } } @@ -87,6 +117,15 @@ public class MinionNPCController : BasicEnemyNPCController //Debug.Log("BRAIN: Following owner"); } + protected virtual void FollowInstruction(Vector3 instructionPosition) + { + agent.speed = patrolAgentSpeed; + patrolDestination = instructionPosition; + patrolDestination.y = 0f; + UpdatePatrolTarget(patrolDestination); + SetAgentMoving(true); + } + [PunRPC] protected override void RPC_OnDeath(bool lootDropped) {