Allow necros to give minions movement instructions on "A" continuous press

This commit is contained in:
Pedro Gomes 2024-12-21 14:33:49 +00:00
parent 8735712630
commit 39290468a2
2 changed files with 57 additions and 12 deletions

View File

@ -4896,7 +4896,7 @@ MonoBehaviour:
coinAmount: 2 coinAmount: 2
extraDropChance: 5 extraDropChance: 5
onCoinDrop: {fileID: 11400000, guid: 48da3b1185c086c4c81a2b97ab7685fc, type: 2} onCoinDrop: {fileID: 11400000, guid: 48da3b1185c086c4c81a2b97ab7685fc, type: 2}
guaranteedDrops: [] guaranteedItemDrop: []
extraDrops: extraDrops:
- {fileID: 11400000, guid: 26b042abfe9104448a1e9599be66e71a, type: 2} - {fileID: 11400000, guid: 26b042abfe9104448a1e9599be66e71a, type: 2}
- {fileID: 11400000, guid: e08687c26614d154cb5a9a01f4b97635, type: 2} - {fileID: 11400000, guid: e08687c26614d154cb5a9a01f4b97635, type: 2}
@ -5172,8 +5172,8 @@ MonoBehaviour:
projectileRange: 5 projectileRange: 5
meleeRange: 2.5 meleeRange: 2.5
distanceToChangePatrolDestination: 0.9 distanceToChangePatrolDestination: 0.9
patrolAgentSpeed: 3 patrolAgentSpeed: 5
chasingAgentSpeed: 2.5 chasingAgentSpeed: 3
timeBetweenAttacks: 2 timeBetweenAttacks: 2
photonView: {fileID: 0} photonView: {fileID: 0}
myTag: {fileID: 0} myTag: {fileID: 0}
@ -5189,6 +5189,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
experienceOnDeath: {fileID: 11400000, guid: 57959f6a9d7e8ab409d77bd400e80224, type: 2} experienceOnDeath: {fileID: 11400000, guid: 57959f6a9d7e8ab409d77bd400e80224, type: 2}
movementMask:
serializedVersion: 2
m_Bits: 8
--- !u!195 &2475434436818348718 --- !u!195 &2475434436818348718
NavMeshAgent: NavMeshAgent:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5341,18 +5344,18 @@ MonoBehaviour:
Vitality: Vitality:
statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2} statTag: {fileID: 11400000, guid: 9bbf01c0977dc98408db3efec6685c56, type: 2}
BaseValue: 1 BaseValue: 1
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 3
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
AttackDamage: AttackDamage:
statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2} statTag: {fileID: 11400000, guid: 09eb68d1a036a1643b74420197b999bd, type: 2}
BaseValue: 1 BaseValue: 1
SpellDamage: SpellDamage:
statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2} statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
BaseValue: 1 BaseValue: 1
CritChance:
statTag: {fileID: 11400000, guid: 831eab0f4c8fb69459a620afd95f698f, type: 2}
BaseValue: 3
CritDamage:
statTag: {fileID: 11400000, guid: ad5c133149d9aa641be97f85e426a01f, type: 2}
BaseValue: 50
MaxHealth: MaxHealth:
statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2} statTag: {fileID: 11400000, guid: 4242916f0b1bf6e4e8a04bce7028b3f4, type: 2}
BaseValue: 0 BaseValue: 0
@ -5501,6 +5504,7 @@ MonoBehaviour:
OnEffectEnded: OnEffectEnded:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
mitigationType: 0
currentDamagePerTick: 0 currentDamagePerTick: 0
OnEffectTick: OnEffectTick:
m_PersistentCalls: m_PersistentCalls:
@ -5528,6 +5532,7 @@ MonoBehaviour:
OnEffectEnded: OnEffectEnded:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
mitigationType: 0
currentDamagePerTick: 0 currentDamagePerTick: 0
OnEffectTick: OnEffectTick:
m_PersistentCalls: m_PersistentCalls:
@ -5555,6 +5560,7 @@ MonoBehaviour:
OnEffectEnded: OnEffectEnded:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
mitigationType: 0
currentDamagePerTick: 0 currentDamagePerTick: 0
OnEffectTick: OnEffectTick:
m_PersistentCalls: m_PersistentCalls:

View File

@ -7,9 +7,20 @@ public class MinionNPCController : BasicEnemyNPCController
{ {
protected bool isReady = false; protected bool isReady = false;
public LayerMask movementMask;
Camera cam;
Plane plane = new Plane(Vector3.down, 0);
Ray ray;
RaycastHit hit;
protected override void Start() protected override void Start()
{ {
cam = Camera.main;
base.Start(); base.Start();
isReady = false; isReady = false;
} }
@ -30,13 +41,32 @@ public class MinionNPCController : BasicEnemyNPCController
counter += Time.deltaTime; 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 else
{ {
PatrollingUpdate(); if (HasTarget())
{
ChasingUpdate();
}
else
{
PatrollingUpdate();
}
} }
} }
@ -87,6 +117,15 @@ public class MinionNPCController : BasicEnemyNPCController
//Debug.Log("BRAIN: Following owner"); //Debug.Log("BRAIN: Following owner");
} }
protected virtual void FollowInstruction(Vector3 instructionPosition)
{
agent.speed = patrolAgentSpeed;
patrolDestination = instructionPosition;
patrolDestination.y = 0f;
UpdatePatrolTarget(patrolDestination);
SetAgentMoving(true);
}
[PunRPC] [PunRPC]
protected override void RPC_OnDeath(bool lootDropped) protected override void RPC_OnDeath(bool lootDropped)
{ {