2019-04-24 17:17:40 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Mirror;
|
2019-04-24 21:02:39 +00:00
|
|
|
|
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(); } }
|
|
|
|
|
|
2019-04-24 21:02:39 +00:00
|
|
|
|
/// <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);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-24 21:02:39 +00:00
|
|
|
|
public override void OnStartLocalPlayer()
|
|
|
|
|
{
|
|
|
|
|
base.OnStartLocalPlayer();
|
|
|
|
|
Local = this;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-24 17:17:40 +00:00
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|