7 namespace droid.Runtime.Prototyping.Configurables {
11 [AddComponentMenu(ConfigurableComponentMenuPath._ComponentMenuPath
12 +
"ScreenSpacePosition" 13 + ConfigurableComponentMenuPath._Postfix)]
14 [RequireComponent(typeof(Renderer))]
33 this._x = this.Identifier +
"X";
34 this._y = this.Identifier +
"Y";
35 this._z = this.Identifier +
"Z";
36 this._rx = this.Identifier +
"RX";
37 this._ry = this.Identifier +
"RY";
38 this._rz = this.Identifier +
"RZ";
39 this._rw = this.Identifier +
"RW";
42 this._camera = FindObjectOfType<Camera>();
50 this.ParentEnvironment =
51 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._x);
52 this.ParentEnvironment =
53 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._y);
54 this.ParentEnvironment =
55 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._z);
56 this.ParentEnvironment =
57 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._rx);
58 this.ParentEnvironment =
59 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._ry);
60 this.ParentEnvironment =
61 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._rz);
62 this.ParentEnvironment =
63 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._rw);
70 if (this.ParentEnvironment == null) {
74 this.ParentEnvironment.UnRegister(
this, this._x);
75 this.ParentEnvironment.UnRegister(
this, this._y);
76 this.ParentEnvironment.UnRegister(
this, this._z);
77 this.ParentEnvironment.UnRegister(
this, this._rx);
78 this.ParentEnvironment.UnRegister(
this, this._ry);
79 this.ParentEnvironment.UnRegister(
this, this._rz);
80 this.ParentEnvironment.UnRegister(
this, this._rw);
83 public override ISpace ConfigurableValueSpace {
get; }
91 DebugPrinting.ApplyPrint(this.Debugging, configuration, this.Identifier);
95 var pos = this.transform.position;
96 var rot = this.transform.rotation;
114 this.transform.position = pos;
115 this.transform.rotation = rot;
126 var a =
new Vector2(x, y);
127 var bounded = Vector2.Min(Vector2.Max(a,
new Vector2(0.2f, 0.2f)),
new Vector2(0.8f, 0.8f));
130 var z = this._camera.nearClipPlane + 2;
131 var bounded3 =
new Vector3(bounded.x, bounded.y, z);
133 var c = this._camera.ViewportToWorldPoint(bounded3);
142 if (sample1 > 0.5f) {
override void UnRegisterComponent()
override void RegisterComponent()
override void ApplyConfiguration(IConfigurableConfiguration configuration)
override Configuration [] SampleConfigurations()