Exemple #1
0
        private void Update()
        {
            //Todo: temporary
            if (_destroied)
            {
                return;
            }

            if (IsLocal)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    var mouse = Input.mousePosition;
                    var pos   = _cam.ScreenToWorldPoint(new Vector3(mouse.x, mouse.y, 2));

                    _position = new PositionData(pos);

                    NetworkController.SendToAll(Handler, Id, _position);

                    transform.position = pos;
                }
            }
            else
            {
                SyncPosition();
            }
        }
Exemple #2
0
        protected override void Awake()
        {
            base.Awake();

            _cam = Camera.main;

            _material = transform.GetComponentInChildren <Renderer>().material;

            transform.position = Vector3.zero;

            _position = new PositionData(transform.position);
        }
Exemple #3
0
 private void ReceivePosition(PositionData pos)
 {
     _position = pos;
 }