using HighlightingSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityTemplateProjects;

namespace AdamSync
{
    public class AsyncObjectBase : MonoBehaviour
    {
        public ulong userID;
        public string userName;
        public ulong roomID;
        public bool isPlayer = false;

        public Animation selfAnimation;
        public Camera selfCamera;


        protected string GetSyncData()
        {
            return string.Format("{0};{1},{2},{3};{4},{5},{6}", userID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
        }

        public void SetPlayerInfo(ulong _userID, string _userName, ulong _roomID, bool _isPlayer)
        {
            userID = _userID;
            userName = _userName;
            roomID = _roomID;
            isPlayer = _isPlayer;
            if (!_isPlayer)
            {
                Destroy(gameObject.GetComponent<HighlightingRenderer>());
                Destroy(gameObject.GetComponent<SimpleCameraController>());
                Destroy(gameObject.GetComponent<PostProcessLayer>());
                Destroy(gameObject.GetComponent<AudioListener>());
                Destroy(gameObject.GetComponent<Camera>());
            }
            else
            {
                //string palyerJoinRoom = "joinroom " + "";
                //_ = SyncCreateRoom.SendMessageAsync(palyerJoinRoom);
                gameObject.tag = "MainCamera";

            }
        }
    }
}