SanAndreasUnity/Assets/Scripts/Networking/Player.cs

47 lines
1.1 KiB
C#
Raw Normal View History

2019-04-24 17:17:40 +00:00
using System.Collections.Generic;
using UnityEngine;
using Mirror;
using SanAndreasUnity.Behaviours;
2019-04-24 17:17:40 +00:00
namespace SanAndreasUnity.Net
{
public class Player : NetworkBehaviour
{
static List<Player> s_allPlayers = new List<Player>();
public static Player[] AllPlayers { get { return s_allPlayers.ToArray(); } }
/// <summary>Local player.</summary>
public static Player Local { get; private set; }
[SyncVar] Ped m_ownedPed;
//public GameObject OwnedGameObject { get { return m_ownedGameObject; } internal set { m_ownedGameObject = value; } }
public Ped OwnedPed { get { return m_ownedPed; } internal set { m_ownedPed = value; } }
2019-04-24 17:39:38 +00:00
2019-04-24 17:17:40 +00:00
void OnEnable()
{
s_allPlayers.Add(this);
}
void OnDisable()
{
s_allPlayers.Remove(this);
}
public override void OnStartLocalPlayer()
{
base.OnStartLocalPlayer();
Local = this;
}
2019-04-24 17:17:40 +00:00
void Start()
{
}
}
}