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(); } }
protected override void Awake() { base.Awake(); _cam = Camera.main; _material = transform.GetComponentInChildren <Renderer>().material; transform.position = Vector3.zero; _position = new PositionData(transform.position); }
private void ReceivePosition(PositionData pos) { _position = pos; }