You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
974 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PlayerData {
  5. public Vector3 Position;
  6. public string Name;
  7. public Color Color;
  8. public byte ID;
  9. public bool isLocalPlayer = false;
  10. public Player Player;
  11. public GameObject gameObject { get { return Player.gameObject; }}
  12. public Transform transform { get { return Player.transform; } }
  13. public PlayerData(byte ID, string Name, Color Color)
  14. {
  15. this.ID = ID;
  16. this.Name = Name;
  17. this.Color = Color;
  18. }
  19. public void SetPosition(Vector3 position)
  20. {
  21. if (Player != null)
  22. Player.transform.position = position;
  23. }
  24. public void Instantiate(GameObject remotePlayerPrefab,Transform parent)
  25. {
  26. Player = GameObject.Instantiate(remotePlayerPrefab, parent).GetComponent<Player>();
  27. Player.SetName(Name);
  28. transform.position = Vector3.zero + Vector3.up * 5.0f;
  29. }
  30. }