/// <inheritdoc />
        public void SetTarget(IPlayerEntity player, uint targetObjectId, TargetModeType targetMode)
        {
            var targetEntity = player.FindEntity <IWorldEntity>(targetObjectId);

            if (targetEntity == null)
            {
                return;
            }

            if (targetMode == TargetModeType.Selected)
            {
                player.Interaction.TargetEntity = targetEntity;
                _logger.LogDebug("Player {0} selected {1} as target.", player.Object.Name, targetEntity.Object.Name);
            }
            else if (targetMode == TargetModeType.Unselected)
            {
                player.Interaction.TargetEntity = null;
                _logger.LogDebug("Player {0} cleared selection on {1}.", player.Object.Name, targetEntity.Object.Name);
            }
            else
            {
                _logger.LogWarning("Player {0} raised an invalid or unknown target mode on {1}.", player.Object.Name, targetEntity.Object.Name);
            }
        }
Exemple #2
0
 /// <inheritdoc />
 public void Deserialize(INetPacketStream packet)
 {
     TargetId   = packet.Read <uint>();
     TargetMode = (TargetModeType)packet.Read <byte>();
 }