working on enemies
This commit is contained in:
50
Assets/jelycho/Code/Beacons/MotherActor.cs
Normal file
50
Assets/jelycho/Code/Beacons/MotherActor.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using RebootKit.Engine.Network;
|
||||
using RebootKit.Engine.Simulation;
|
||||
using RebootReality.jelycho.Enemies;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootReality.jelycho.Beacons {
|
||||
public class MotherActorData : IActorData {
|
||||
public ulong Health;
|
||||
public float HungerLevel;
|
||||
|
||||
public int GetMaxBytes() {
|
||||
return sizeof(ulong) +
|
||||
sizeof(float);
|
||||
}
|
||||
|
||||
public void Serialize(NetworkBufferWriter writer) {
|
||||
writer.Write(Health);
|
||||
writer.Write(HungerLevel);
|
||||
}
|
||||
|
||||
public void Deserialize(NetworkBufferReader reader) {
|
||||
reader.Read(out Health);
|
||||
reader.Read(out HungerLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public class MotherActor : Actor, IKillable {
|
||||
MotherActorData m_ActorData = new MotherActorData();
|
||||
|
||||
[field: SerializeField] public Transform GutConnector { get; private set; }
|
||||
|
||||
//
|
||||
// @MARK: Actor
|
||||
//
|
||||
protected override IActorData CreateActorData() {
|
||||
return m_ActorData;
|
||||
}
|
||||
|
||||
//
|
||||
// @MARK: IKillable
|
||||
//
|
||||
public bool IsAlive() {
|
||||
return m_ActorData.Health > 0;
|
||||
}
|
||||
|
||||
public ulong OnHit(Actor attacker, ulong damage) {
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user