public ProjectionScreen(GameObject parent, ManipulationSpot s, GameObject t) { spot = s; screenTarget = t; container = GameObject.Instantiate <RelativePositionContainer>(s.containerTemplate); spot.target.OnClicked .Do(_ => { container.SetTarget(screenTarget, spot.boundingBox.transform.position); }) .Subscribe() .AddTo(parent); spot.boundingBox.Done .Do(_ => { container.Done(); }) .Subscribe() .AddTo(parent); spot.boundingBox.Position .Do(p => { container.UpdateTo(p); }) .Subscribe() .AddTo(parent); }
public void Initialize() { container = Instantiate <RelativePositionContainer>(containerTemplate); target.OnClicked .Do(_ => { boundingBox.SetTarget(target.gameObject); container.SetTarget(target.gameObject, boundingBox.transform.position); }) .Subscribe() .AddTo(this); boundingBox.Done .Do(_ => { container.Done(); boundingBox.Disable(); }) .Subscribe() .AddTo(this); boundingBox.Position .Do(p => { container.UpdateTo(p); }) .Subscribe() .AddTo(this); }