using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerData {
|
|
|
|
public Vector3 Position;
|
|
public string Name;
|
|
public Color Color;
|
|
public byte ID;
|
|
|
|
public bool isLocalPlayer = false;
|
|
|
|
public Player Player;
|
|
|
|
public GameObject gameObject { get { return Player.gameObject; }}
|
|
public Transform transform { get { return Player.transform; } }
|
|
|
|
public PlayerData(byte ID, string Name, Color Color)
|
|
{
|
|
this.ID = ID;
|
|
this.Name = Name;
|
|
this.Color = Color;
|
|
}
|
|
|
|
public void SetPosition(Vector3 position)
|
|
{
|
|
if (Player != null)
|
|
Player.transform.position = position;
|
|
}
|
|
|
|
public void Instantiate(GameObject remotePlayerPrefab,Transform parent)
|
|
{
|
|
Player = GameObject.Instantiate(remotePlayerPrefab, parent).GetComponent<Player>();
|
|
Player.SetName(Name);
|
|
transform.position = Vector3.zero + Vector3.up * 5.0f;
|
|
}
|
|
|
|
}
|