Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using MLAPI.Logging;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MLAPI.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that represents a NetworkPrefab
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class NetworkPrefab
|
||||
{
|
||||
internal ulong Hash
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Prefab == null)
|
||||
{
|
||||
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
|
||||
{
|
||||
NetworkLog.LogWarning($"{nameof(NetworkPrefab)} is not assigned");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
var networkObject = Prefab.GetComponent<NetworkObject>();
|
||||
if (networkObject == null)
|
||||
{
|
||||
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
|
||||
{
|
||||
NetworkLog.LogWarning($"{nameof(NetworkPrefab)} {Prefab.name} does not have a {nameof(NetworkObject)}");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return networkObject.PrefabHash;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The gameobject of the prefab
|
||||
/// </summary>
|
||||
public GameObject Prefab;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this is a playerPrefab
|
||||
/// </summary>
|
||||
public bool PlayerPrefab;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue