mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
Create Player script
This commit is contained in:
parent
65bbc394b5
commit
06a2dc4c5f
2 changed files with 43 additions and 0 deletions
32
Assets/Scripts/Networking/Player.cs
Normal file
32
Assets/Scripts/Networking/Player.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Mirror;
|
||||
|
||||
namespace SanAndreasUnity.Net
|
||||
{
|
||||
|
||||
public class Player : NetworkBehaviour
|
||||
{
|
||||
|
||||
static List<Player> s_allPlayers = new List<Player>();
|
||||
public static Player[] AllPlayers { get { return s_allPlayers.ToArray(); } }
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
s_allPlayers.Add(this);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
s_allPlayers.Remove(this);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Networking/Player.cs.meta
Normal file
11
Assets/Scripts/Networking/Player.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 44df51f4023494b6daf499c76c834403
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue