first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using NitroxModel.Core;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.GameLogic.Spawning.Metadata.Processor.Abstract;
|
||||
|
||||
public abstract class EntityMetadataProcessor<TMetadata> : IEntityMetadataProcessor where TMetadata : EntityMetadata
|
||||
{
|
||||
public abstract void ProcessMetadata(GameObject gameObject, TMetadata metadata);
|
||||
|
||||
public void ProcessMetadata(GameObject gameObject, EntityMetadata metadata)
|
||||
{
|
||||
ProcessMetadata(gameObject, (TMetadata)metadata);
|
||||
}
|
||||
|
||||
protected TService Resolve<TService>() where TService : class
|
||||
{
|
||||
return NitroxServiceLocator.Cache<TService>.Value;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.GameLogic.Spawning.Metadata.Processor.Abstract;
|
||||
|
||||
public interface IEntityMetadataProcessor
|
||||
{
|
||||
public abstract void ProcessMetadata(GameObject gameObject, EntityMetadata metadata);
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using NitroxClient.Unity.Helper;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.GameLogic.Spawning.Metadata.Processor.Abstract;
|
||||
|
||||
public abstract class VehicleMetadataProcessor<T> : EntityMetadataProcessor<T> where T : VehicleMetadata
|
||||
{
|
||||
private readonly LiveMixinManager liveMixinManager;
|
||||
|
||||
public VehicleMetadataProcessor(LiveMixinManager liveMixinManager)
|
||||
{
|
||||
this.liveMixinManager = liveMixinManager;
|
||||
}
|
||||
|
||||
protected void SetHealth(GameObject gameObject, float health)
|
||||
{
|
||||
LiveMixin liveMixin = gameObject.RequireComponentInChildren<LiveMixin>(true);
|
||||
liveMixinManager.SyncRemoteHealth(liveMixin, health);
|
||||
}
|
||||
|
||||
protected void SetNameAndColors(SubName subName, string text, NitroxVector3[] nitroxColor) => SubNameInputMetadataProcessor.SetNameAndColors(subName, text, nitroxColor);
|
||||
}
|
Reference in New Issue
Block a user