private void Start() { _camp = GameObject.Find("InitializeController").GetComponent <Initialize>().Camp; GameBody.GetComponent <SpriteRenderer>().color = _camp; Interact.GetComponent <InteractController>().InteractAreaColor = _camp; Interact.GetComponent <InteractController>().InteractCollider.GetComponent <ColliderController>().Camp = _camp; BodyCollider.GetComponent <ColliderController>().Camp = _camp; StateBar statebar = Info.GetComponent <StateBar>(); _health = PlayerConfig._TotalHealth; _energy = PlayerConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = _energy; statebar.CurrentHealth = _health; GameObject.Find("Collector").GetComponent <Collector>().Player = gameObject; Vector3 CP = new Vector3(); CP = transform.position; CP.z = -10; Camera.main.transform.position = CP; WS = GameObject.Find("WebSocketController").GetComponent <WebSocketController>(); PP = new MessageBox.PlayerPosition(); MB = new MessageBox.MessageBase(); }
// Use this for initialization void Awake() { MessageBase = new MessageBox.MessageBase(); InitializeMessage = new MessageBox.InitializeMessage(); OtherInitializeMessage = new MessageBox.OtherInitializeMessage(); PlayerPosition = new MessageBox.PlayerPosition(); BulletMessage = new MessageBox.BulletMessage(); ChangeStateBar = new MessageBox.ChangeStateBar(); BuildMessage = new MessageBox.BuildMessage(); Collector = GameObject.Find("Collector").GetComponent <Collector>(); Initialize = GameObject.Find("InitializeController").GetComponent <Initialize>(); Debug.Log("start connect"); SocketConnect("ws://192.168.0.106:2222"); Debug.Log("connect done"); Bullet = Resources.Load <GameObject>("Prefabs/OtherBullet"); }