1
0
forked from cgvr/DeltaVR

deltavr multiplayer 2.0

This commit is contained in:
Toomas Tamm
2023-05-08 15:56:10 +03:00
parent 978809a002
commit 07b9b9e2f4
10937 changed files with 2968397 additions and 1521012 deletions

View File

@@ -0,0 +1,59 @@
namespace UnityEngine.XR.Content.Interaction
{
/// <summary>
/// This class is responsible for creating the perler sockets grid and turning on/off the machine.
/// </summary>
public class PerlerMachineController : MonoBehaviour
{
static readonly string k_EmissionKeyword = "_EMISSION";
[SerializeField]
[Tooltip("The emissive materials that will change state whenever the machine is turned on/off")]
Material[] m_EmissiveMaterials;
bool m_MachineActive;
void Awake()
{
DisableEmissiveMaterials();
}
#if UNITY_EDITOR
void OnDestroy()
{
EnableEmissiveMaterials();
}
#endif
void DisableEmissiveMaterials()
{
foreach (var material in m_EmissiveMaterials)
material.DisableKeyword(k_EmissionKeyword);
}
void EnableEmissiveMaterials()
{
foreach (var material in m_EmissiveMaterials)
material.EnableKeyword(k_EmissionKeyword);
}
/// <summary>
/// Call this method to activate or deactivate the machine. This will also turn on/off its lights.
/// Used by the BatterySlot GameObject socket.
/// </summary>
/// <param name="active">Value of <see langword="true"/> to activate the machine; <see langword="false"/> otherwise.</param>
public void SetMachineActive(bool active)
{
// It's the same state?
if (active == m_MachineActive)
return;
// Change the machine light state
m_MachineActive = active;
if (m_MachineActive)
EnableEmissiveMaterials();
else
DisableEmissiveMaterials();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cc7fa0773a606e42930df5c728731e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: