Init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Mirror;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VRNetworkPlayerScript : NetworkBehaviour
|
||||
{
|
||||
public Transform headTransform;
|
||||
public VRPlayerRig vrPlayerRig;
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
public override void OnStartLocalPlayer()
|
||||
{
|
||||
// create a link to local vr rig, so that rig can sync to our local network players transforms
|
||||
vrPlayerRig = GameObject.FindFirstObjectByType<VRPlayerRig>();
|
||||
vrPlayerRig.localVRNetworkPlayerScript = this;
|
||||
|
||||
}
|
||||
// a static global list of players that can be used for a variery of features, one being enemies
|
||||
public readonly static List<VRNetworkPlayerScript> playersList = new List<VRNetworkPlayerScript>();
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
playersList.Add(this);
|
||||
}
|
||||
|
||||
public override void OnStopServer()
|
||||
{
|
||||
playersList.Remove(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user