working on humbie still
This commit is contained in:
@@ -4,15 +4,17 @@ using RebootKit.Engine.Extensions;
|
||||
using RebootKit.Engine.Main;
|
||||
using RebootKit.Engine.Network;
|
||||
using RebootKit.Engine.Simulation;
|
||||
using RebootReality.jelycho.Actors;
|
||||
using RebootReality.jelycho.Enemies;
|
||||
using RebootReality.jelycho.Items;
|
||||
using RebootReality.jelycho.Main;
|
||||
using Unity.Collections;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using Logger = RebootKit.Engine.Foundation.Logger;
|
||||
|
||||
namespace RebootReality.jelycho.Player {
|
||||
public class PlayerActor : Actor, IKillable {
|
||||
public class PlayerActor : Actor, IHasHealth {
|
||||
static readonly Logger s_Logger = new Logger(nameof(PlayerActor));
|
||||
|
||||
[SerializeField] PlayerAnimator m_PlayerAnimator;
|
||||
@@ -526,23 +528,6 @@ namespace RebootReality.jelycho.Player {
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PlayerActorCommands.DealDamage: {
|
||||
PlayerActorDealDamageCommand dealDamageCommand = new PlayerActorDealDamageCommand();
|
||||
DataSerializationUtils.Deserialize(actorCommand.Data, ref dealDamageCommand);
|
||||
|
||||
Actor targetActor = RR.FindSpawnedActor(dealDamageCommand.TargetActorID);
|
||||
if (targetActor == null) {
|
||||
s_Logger.Error($"Target actor with ID {dealDamageCommand.TargetActorID} not found.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetActor is IKillable killable) {
|
||||
killable.OnHit(this, 100);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,18 +658,6 @@ namespace RebootReality.jelycho.Player {
|
||||
}
|
||||
}
|
||||
|
||||
public void DealDamage(IKillable target) {
|
||||
if (target is Actor actor) {
|
||||
var dealDamageCommand = new PlayerActorDealDamageCommand {
|
||||
TargetActorID = actor.ActorID
|
||||
};
|
||||
SendActorCommand((byte) PlayerActorCommands.DealDamage,
|
||||
ref dealDamageCommand);
|
||||
} else {
|
||||
s_Logger.Error($"Player can only deal damage to other actors!");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @MARK: Remote
|
||||
//
|
||||
@@ -830,16 +803,15 @@ namespace RebootReality.jelycho.Player {
|
||||
}
|
||||
|
||||
//
|
||||
// @MARK: IKillable
|
||||
// @MARK: IHasHealth
|
||||
//
|
||||
public ulong Health { get; private set; } = 100;
|
||||
public ulong MaxHealth { get; private set; } = 100;
|
||||
|
||||
public bool IsAlive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ulong OnHit(Actor attacker, ulong damage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// @MARK: Common
|
||||
//
|
||||
@@ -1055,8 +1027,7 @@ namespace RebootReality.jelycho.Player {
|
||||
DropItem = 0x03,
|
||||
EquipItem = 0x04,
|
||||
SelectItemSlot = 0x05,
|
||||
RequestHandsAnimation = 0x06,
|
||||
DealDamage = 0x07
|
||||
RequestHandsAnimation = 0x06
|
||||
}
|
||||
|
||||
struct PlayerActorPickupItemCommand : IActorData {
|
||||
@@ -1139,22 +1110,6 @@ namespace RebootReality.jelycho.Player {
|
||||
}
|
||||
}
|
||||
|
||||
struct PlayerActorDealDamageCommand : IActorData {
|
||||
public ushort TargetActorID;
|
||||
|
||||
public int GetMaxBytes() {
|
||||
return sizeof(ushort);
|
||||
}
|
||||
|
||||
public void Serialize(NetworkBufferWriter writer) {
|
||||
writer.Write(TargetActorID);
|
||||
}
|
||||
|
||||
public void Deserialize(NetworkBufferReader reader) {
|
||||
reader.Read(out TargetActorID);
|
||||
}
|
||||
}
|
||||
|
||||
// @MARK: Player Actor Events
|
||||
enum PlayerActorEvents : byte {
|
||||
None = 0x00,
|
||||
|
||||
Reference in New Issue
Block a user