Skip to content

Commit

Permalink
when attacking a dead entity, run to interact range
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Nov 13, 2024
1 parent ecbab8c commit d51d2d4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
16 changes: 8 additions & 8 deletions l2-unity/Assets/Resources/Data/Effects/skybox/L2Sky.mat
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SunMoon:
m_Texture: {fileID: 2800000, guid: b443728fc86061b4f8ecbe8a96c9d2ef, type: 3}
m_Scale: {x: 2.5, y: 2.5}
m_Texture: {fileID: 2800000, guid: 87bfdbc0202b0e440b4b25a3824f15db, type: 3}
m_Scale: {x: 1.5, y: 1.5}
m_Offset: {x: 0.5, y: 0.5}
- unity_Lightmaps:
m_Texture: {fileID: 0}
Expand All @@ -70,13 +70,13 @@ Material:
- _Cloud_Cutoff: 4.01
- _Cloud_Distance: 0.8
- _Clouds_Far_Tiling: 0.352
- _Clouds_Opacity: 0.12
- _Clouds_Opacity: 2.54
- _Clouds_Tiling: 0.12
- _GradientColor1Influence: 0.6
- _GradientColor2Influence: 0.5
- _HorizonCloudsRotationSpeed: -0.1
- _Horizon_Clouds_Height: 1.44
- _Horizon_Clouds_Opacity: 0.05
- _Horizon_Clouds_Opacity: 1
- _Horizon_Clouds_X_Tile: 1
- _Horizon_Clouds_Y_Tile: 3.17
- _QueueControl: 0
Expand All @@ -92,12 +92,12 @@ Material:
- _Stars_Y_Tile: 1
- _SunMoonSize: 0.13
m_Colors:
- _GradientColor1: {r: -0.003921569, g: -0.003921569, b: -0.007843138, a: -1}
- _GradientColor1: {r: 0, g: 0.3529412, b: 0.54901963, a: 1}
- _GradientColor2: {r: 0, g: 0, b: 0, a: 1}
- _GradientColor3: {r: 7.488819, g: 7.981503, b: 8.47419, a: 1}
- _MainLightForward: {r: -0.03662476, g: -0.9986578, b: -0.036624923, a: 0}
- _MainLightRight: {r: 0.7071067, g: 0, b: -0.70710695, a: 0}
- _MainLightUp: {r: 0.7061578, g: -0.05179538, b: 0.7061577, a: 0}
- _MainLightForward: {r: -0.23021153, g: -0.9455186, b: -0.23021153, a: 0}
- _MainLightRight: {r: 0.7071067, g: 0, b: -0.7071068, a: 0}
- _MainLightUp: {r: 0.6685827, g: -0.32556826, b: 0.66858256, a: 0}
- _SunMoonColor: {r: 1, g: 1, b: 1, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void Enter(object arg0)
// Debug.Log($"target: {target} distance: {distance} range: {attackRange}");

// Is close enough? Is player already waiting for server reply?
if (distance <= attackRange * 0.95f && !_stateMachine.WaitingForServerReply)
if (distance <= attackRange * 0.95f && !_stateMachine.WaitingForServerReply && !targetEntity.IsDead)
{
PlayerController.Instance.UpdateFinalAngleToLookAt(targetEntity.transform);

Expand All @@ -48,9 +48,18 @@ public override void Enter(object arg0)
else
{
// Move to target with a 5% error margin

MoveReason reason = MoveReason.ATTACK;

if (targetEntity.IsDead)
{
attackRange = WorldCombat.Instance.GetInteractRange(PlayerEntity.Instance, targetEntity);
reason = MoveReason.DEFAULT;
}

PathFinderController.Instance.MoveTo(targetPos, attackRange * 0.95f, () =>
{
_stateMachine.ChangeIntention(Intention.INTENTION_FOLLOW, MoveReason.ATTACK);
_stateMachine.ChangeIntention(Intention.INTENTION_FOLLOW, reason);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading;
using UnityEditor.VersionControl;
using UnityEngine;

public class GameClientPacketHandler : ClientPacketHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void UpdateMoveDirection(Vector3 direction)
// Move to destination packets
public void SetDestination(Vector3 destination, float stopAtRange)
{
Debug.LogWarning("Set destination: " + destination);
// Debug.LogWarning("Set destination: " + destination);
if (_lastDestination == destination)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void ManageColors()
{
if (_previousServerTitleColor != _entity.Appearance.ServerTitleColor)
{
Debug.LogWarning($"Title color changed: Old:{_previousServerTitleColor} New:{_entity.Appearance.ServerTitleColor}");
// Debug.LogWarning($"Title color changed: Old:{_previousServerTitleColor} New:{_entity.Appearance.ServerTitleColor}");
_previousServerTitleColor = _entity.Appearance.ServerTitleColor;

if (_previousServerTitleColor != 0)
Expand Down Expand Up @@ -96,7 +96,7 @@ public void ManageColors()
_lastFlag = 0;
_previousKarmaAmount = 0;

Debug.LogWarning($"Name color changed: Old:{_previousServerNameColor} New:{_entity.Appearance.ServerNameColor}");
// Debug.LogWarning($"Name color changed: Old:{_previousServerNameColor} New:{_entity.Appearance.ServerNameColor}");
_previousServerNameColor = _entity.Appearance.ServerNameColor;

if (_previousServerNameColor != 0)
Expand Down

0 comments on commit d51d2d4

Please sign in to comment.