Added Swap

main
Hazim Bin Ijaz 2 months ago
parent 8ab130dc7d
commit 7b825ef1b3

@ -0,0 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 51bc649ad66145f4f9160e06d4162795, type: 3}
m_Name: Swap
m_EditorClassIdentifier:
Config:
Logic: 18
Amount: 0
ManaCost: 0
Range: 0
DurationSeconds: 0
ExecTimeSeconds: 0
EffectDurationSeconds: 0
ReuseTimeSeconds: 0
AnimAnticipation:
Anim:
Anim2:
ReactAnim:
OtherAnimatorVariable:
SplashDamage: 0
MoveSpeed: 0
KnockbackSpeed: 0
KnockbackDuration: 0
Radius: 0
ActionInput: {fileID: 0}
ActionInterruptible: 0
IsInterruptableBy: []
BlockingMode: 1
Projectiles: []
Spawns: []
IsFriendly: 0
Icon: {fileID: 0}
DisplayedName:
Description:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c55ead416f0a54c4f95b4664d7e5bea1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

@ -8240,11 +8240,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 0.8529446 value: 0.85294455
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0.39434478 value: 0.3943448
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
@ -8252,7 +8252,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734515771252668, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0.14352977 value: -0.14352979
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734516302391364, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734516302391364, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_UpdateMethod propertyPath: m_UpdateMethod
@ -8284,11 +8284,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734516695783279, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734516695783279, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.3097298 value: 0.30972984
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734516695783279, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734516695783279, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0.14506969 value: -0.1450697
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1676734516724634599, guid: 0193228de87741d40a42e561901c9083, type: 3} - target: {fileID: 1676734516724634599, guid: 0193228de87741d40a42e561901c9083, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@ -8401,15 +8401,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3} - target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0.3943448 value: 0.39434484
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3} - target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.31044644 value: 0.3104465
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3} - target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0.14352976 value: -0.1435298
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3} - target: {fileID: 203267159508449512, guid: 36b3ee75677a1544191c0ddaaadd8140, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
@ -9672,7 +9672,7 @@ MonoBehaviour:
m_OverrideVoxelSize: 0 m_OverrideVoxelSize: 0
m_VoxelSize: 0.16666667 m_VoxelSize: 0.16666667
m_MinRegionArea: 2 m_MinRegionArea: 2
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 23800000, guid: cd817e3eace813041ad4d732be64af84, type: 2}
m_BuildHeightMesh: 0 m_BuildHeightMesh: 0
--- !u!1001 &3765979715153886892 --- !u!1001 &3765979715153886892
PrefabInstance: PrefabInstance:

@ -804,6 +804,112 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1146060681} m_GameObject: {fileID: 1146060681}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1415641637
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1415641641}
- component: {fileID: 1415641640}
- component: {fileID: 1415641639}
- component: {fileID: 1415641638}
m_Layer: 8
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &1415641638
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415641637}
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: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1415641639
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415641637}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1415641640
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415641637}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1415641641
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415641637}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.58, y: -0.14, z: 1.84}
m_LocalScale: {x: 1.2077, y: 1.2077, z: 1.2077}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1463337822 --- !u!1 &1463337822
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1070,3 +1176,4 @@ SceneRoots:
- {fileID: 2085312387} - {fileID: 2085312387}
- {fileID: 949745749} - {fileID: 949745749}
- {fileID: 286165427} - {fileID: 286165427}
- {fileID: 1415641641}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cd817e3eace813041ad4d732be64af84
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 23800000
userData:
assetBundleName:
assetBundleVariant:

@ -520,6 +520,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
GlobalObjectIdHash: 2270253351 GlobalObjectIdHash: 2270253351
InScenePlacedSourceGlobalObjectIdHash: 0
AlwaysReplicateAsRoot: 0 AlwaysReplicateAsRoot: 0
SynchronizeTransform: 0 SynchronizeTransform: 0
ActiveSceneSynchronization: 0 ActiveSceneSynchronization: 0
@ -1459,6 +1460,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 370034730102636685, guid: 4512c09d24f3fa147afb198fa90d63c6, type: 3}
propertyPath: m_GeneralSwapActionPrototype
value:
objectReference: {fileID: 11400000, guid: c55ead416f0a54c4f95b4664d7e5bea1, type: 2}
- target: {fileID: 1133988469759348351, guid: 4512c09d24f3fa147afb198fa90d63c6, type: 3} - target: {fileID: 1133988469759348351, guid: 4512c09d24f3fa147afb198fa90d63c6, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: GameDataSource value: GameDataSource

@ -0,0 +1,73 @@
using Unity.BossRoom.Gameplay.Actions;
using Unity.BossRoom.Gameplay.GameplayObjects.Character;
using Unity.Netcode;
using UnityEngine;
[CreateAssetMenu(menuName = "BossRoom/Actions/Swap Action")]
public class SwapAction : Action
{
private ServerCharacter m_TargetCharacter; // The character to swap with
private Vector3 m_TargetOriginalPosition; // Target's original position
private Vector3 m_ServerCharacterOriginalPosition; // Server character's original position
private bool m_MovementStarted = false; // Ensures movement commands are sent only once
public override bool OnStart(ServerCharacter serverCharacter)
{
// Validate the target
if (Data.TargetIds == null || Data.TargetIds.Length == 0)
{
Debug.LogError("SwapAction failed: No target specified!");
return false; // End the action immediately
}
// Retrieve the target character
if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(Data.TargetIds[0], out var targetObject) ||
!targetObject.TryGetComponent(out m_TargetCharacter))
{
Debug.LogError("SwapAction failed: Target is invalid or missing!");
return false; // End the action immediately
}
// Store original positions
m_ServerCharacterOriginalPosition = serverCharacter.physicsWrapper.Transform.position;
m_TargetOriginalPosition = m_TargetCharacter.physicsWrapper.Transform.position;
// Command both characters to move to each other's original positions
serverCharacter.ServerSendCharacterInputRpc(m_TargetOriginalPosition);
m_TargetCharacter.ServerSendCharacterInputRpc(m_ServerCharacterOriginalPosition);
Debug.Log("SwapAction: Movement commands sent to both players.");
m_MovementStarted = true;
return true; // Keep the action active
}
public override bool OnUpdate(ServerCharacter serverCharacter)
{
if (!m_MovementStarted)
{
Debug.LogError("SwapAction OnUpdate called without movement initialization!");
return false; // Fail-safe: End the action
}
// Check if both characters have reached their destinations
bool serverCharacterReached = Vector3.Distance(serverCharacter.physicsWrapper.Transform.position, m_TargetOriginalPosition) < 0.1f;
bool targetCharacterReached = Vector3.Distance(m_TargetCharacter.physicsWrapper.Transform.position, m_ServerCharacterOriginalPosition) < 0.1f;
if (serverCharacterReached && targetCharacterReached)
{
Debug.Log("SwapAction: Both players have swapped positions successfully.");
return false; // End the action
}
return true; // Continue the action until both characters reach their destinations
}
public override void Reset()
{
base.Reset();
m_TargetCharacter = null;
m_TargetOriginalPosition = Vector3.zero;
m_ServerCharacterOriginalPosition = Vector3.zero;
m_MovementStarted = false;
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51bc649ad66145f4f9160e06d4162795
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -24,6 +24,7 @@ namespace Unity.BossRoom.Gameplay.Actions
DashAttack, DashAttack,
ImpToss, ImpToss,
PickUp, PickUp,
Drop Drop,
Swap
} }
} }

@ -140,6 +140,10 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
private AIBrain m_AIBrain; private AIBrain m_AIBrain;
NetworkAvatarGuidState m_State; NetworkAvatarGuidState m_State;
public ulong? PendingSwapRequest { get; set; }
void Awake() void Awake()
{ {
m_ServerActionPlayer = new ServerActionPlayer(this); m_ServerActionPlayer = new ServerActionPlayer(this);
@ -148,6 +152,19 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
m_State = GetComponent<NetworkAvatarGuidState>(); m_State = GetComponent<NetworkAvatarGuidState>();
} }
[Rpc(SendTo.Server, RequireOwnership = false)]
public void NotifySwapRequestRpc(ulong initiatingPlayerId)
{
PendingSwapRequest = initiatingPlayerId;
Debug.Log($"Swap request received from Player {initiatingPlayerId}. Press 'L' to confirm.");
}
[Rpc(SendTo.Server, RequireOwnership = false)]
public void NotifySwapConfirmedRpc(ulong targetPlayerId)
{
Debug.Log($"Swap request confirmed by Player {targetPlayerId}.");
}
public override void OnNetworkSpawn() public override void OnNetworkSpawn()
{ {
if (!IsServer) { enabled = false; } if (!IsServer) { enabled = false; }

@ -24,6 +24,9 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects
//Actions that are directly listed here will get automatically assigned ActionIDs and they don't need to be a part of m_ActionPrototypes array //Actions that are directly listed here will get automatically assigned ActionIDs and they don't need to be a part of m_ActionPrototypes array
[Header("Common action prototypes")] [Header("Common action prototypes")]
[SerializeField]
Action m_GeneralSwapActionPrototype;
[SerializeField] [SerializeField]
Action m_GeneralChaseActionPrototype; Action m_GeneralChaseActionPrototype;
@ -59,6 +62,7 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects
private Action[] m_ActionPrototypes; private Action[] m_ActionPrototypes;
public Action GeneralChaseActionPrototype => m_GeneralChaseActionPrototype; public Action GeneralChaseActionPrototype => m_GeneralChaseActionPrototype;
public Action GeneralSwapActionPrototype => m_GeneralSwapActionPrototype;
public Action GeneralTargetActionPrototype => m_GeneralTargetActionPrototype; public Action GeneralTargetActionPrototype => m_GeneralTargetActionPrototype;
@ -148,7 +152,7 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects
uniqueActions.Add(StunnedActionPrototype); uniqueActions.Add(StunnedActionPrototype);
uniqueActions.Add(DropActionPrototype); uniqueActions.Add(DropActionPrototype);
uniqueActions.Add(PickUpActionPrototype); uniqueActions.Add(PickUpActionPrototype);
uniqueActions.Add(GeneralSwapActionPrototype);
m_AllActions = new List<Action>(uniqueActions.Count); m_AllActions = new List<Action>(uniqueActions.Count);
int i = 0; int i = 0;

@ -514,6 +514,41 @@ namespace Unity.BossRoom.Gameplay.UserInput
{ {
RequestAction(GameDataSource.Instance.Emote4ActionPrototype.ActionID, SkillTriggerStyle.Keyboard); RequestAction(GameDataSource.Instance.Emote4ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
} }
if (Input.GetKeyDown(KeyCode.L)) // Press L to confirm the swap
{
if (m_ServerCharacter.PendingSwapRequest.HasValue)
{
ulong initiatingPlayerId = m_ServerCharacter.PendingSwapRequest.Value;
if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(initiatingPlayerId, out var initiatingPlayerObject) &&
initiatingPlayerObject.TryGetComponent(out ServerCharacter initiatingPlayer))
{
// Store positions of both players
Vector3 initiatingPlayerPosition = initiatingPlayer.physicsWrapper.Transform.position;
Vector3 targetPlayerPosition = m_ServerCharacter.physicsWrapper.Transform.position;
// Execute the swap
initiatingPlayer.ServerSendCharacterInputRpc(targetPlayerPosition);
m_ServerCharacter.ServerSendCharacterInputRpc(initiatingPlayerPosition);
Debug.Log($"Swap confirmed: {initiatingPlayer.name} swapped with {m_ServerCharacter.name}.");
// Clear the pending request
m_ServerCharacter.PendingSwapRequest = null;
// Notify initiating player about confirmation (optional for UI feedback)
initiatingPlayer.NotifySwapConfirmedRpc(m_ServerCharacter.NetworkObjectId);
}
else
{
Debug.LogError("Swap confirmation failed: Initiating player not found.");
}
}
else
{
Debug.Log("No pending swap request to confirm.");
}
}
if (!EventSystem.current.IsPointerOverGameObject() && m_CurrentSkillInput == null) if (!EventSystem.current.IsPointerOverGameObject() && m_CurrentSkillInput == null)
{ {
@ -525,17 +560,43 @@ namespace Unity.BossRoom.Gameplay.UserInput
RequestAction(CharacterClass.Skill1.ActionID, SkillTriggerStyle.MouseClick); RequestAction(CharacterClass.Skill1.ActionID, SkillTriggerStyle.MouseClick);
} }
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0)) // Left-click triggers the SwapAction request
{ {
RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype.ActionID, SkillTriggerStyle.MouseClick); var ray = m_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
int hits = Physics.RaycastNonAlloc(ray, k_CachedHit, k_MouseInputRaycastDistance, m_ActionLayerMask);
if (hits > 0)
{
for (int i = 0; i < hits; i++)
{
if (k_CachedHit[i].transform.TryGetComponent(out NetworkObject targetNetObj) &&
targetNetObj != m_ServerCharacter.NetworkObject)
{
// Retrieve the target character
if (!targetNetObj.TryGetComponent(out ServerCharacter targetCharacter))
{
Debug.LogError("SwapAction failed: Target is not a valid ServerCharacter!");
return;
}
// Notify the target player (send confirmation request)
targetCharacter.NotifySwapRequestRpc(m_ServerCharacter.NetworkObjectId);
Debug.Log($"SwapAction requested: Waiting for {targetCharacter.name} to confirm.");
return; // Exit loop after sending the request
}
}
}
} }
else if (Input.GetMouseButton(0))
else if(Input.GetMouseButtonDown(0))
{ {
m_MoveRequest = true; m_MoveRequest = true; // Set move request for holding left-click
} }
} }
} }
void UpdateAction1() void UpdateAction1()
{ {
var isHoldingNetworkObject = var isHoldingNetworkObject =
@ -553,19 +614,19 @@ namespace Unity.BossRoom.Gameplay.UserInput
actionState1.actionID = GameDataSource.Instance.DropActionPrototype.ActionID; actionState1.actionID = GameDataSource.Instance.DropActionPrototype.ActionID;
} }
else if ((m_ServerCharacter.TargetId.Value != 0 else if ((m_ServerCharacter.TargetId.Value != 0
&& selection != null && selection != null
&& selection.TryGetComponent(out PickUpState pickUpState)) && selection.TryGetComponent(out PickUpState pickUpState))
) )
{ {
// special case: targeting a pickup-able item or holding a pickup object // special case: targeting a pickup-able item or holding a pickup object
actionState1.actionID = GameDataSource.Instance.PickUpActionPrototype.ActionID; actionState1.actionID = GameDataSource.Instance.PickUpActionPrototype.ActionID;
} }
else if (m_ServerCharacter.TargetId.Value != 0 else if (m_ServerCharacter.TargetId.Value != 0
&& selection != null && selection != null
&& selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId && selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId
&& selection.TryGetComponent(out ServerCharacter charState) && selection.TryGetComponent(out ServerCharacter charState)
&& !charState.IsNpc) && !charState.IsNpc)
{ {
// special case: when we have a player selected, we change the meaning of the basic action // special case: when we have a player selected, we change the meaning of the basic action
// we have another player selected! In that case we want to reflect that our basic Action is a Revive, not an attack! // we have another player selected! In that case we want to reflect that our basic Action is a Revive, not an attack!

Loading…
Cancel
Save