22using System . Collections . Generic ;
33using System . Threading . Tasks ;
44using IO . Swagger . Model ;
5- using System ;
65
76namespace Base {
87 public abstract class ActionObject : InteractiveObject , IActionProvider , IActionPointParent {
@@ -44,7 +43,7 @@ public virtual void InitActionObject(IO.Swagger.Model.SceneObject sceneObject, V
4443 }
4544
4645 }
47-
46+
4847 public virtual void UpdateObjectName ( string newUserId ) {
4948 Data . Name = newUserId ;
5049 SelectorItem . SetText ( newUserId ) ;
@@ -74,9 +73,9 @@ public virtual void ActionObjectUpdate(IO.Swagger.Model.SceneObject actionObject
7473 } else {
7574 ObjectParameters [ p . Name ] . Value = p . Value ;
7675 }
77-
76+
7877 }
79-
78+
8079 }
8180
8281 public void ResetPosition ( ) {
@@ -98,7 +97,7 @@ public bool TryGetParameter(string id, out IO.Swagger.Model.Parameter parameter)
9897 parameter = null ;
9998 return false ;
10099 }
101-
100+
102101 public bool TryGetParameterMetadata ( string id , out IO . Swagger . Model . ParameterMeta parameterMeta ) {
103102 foreach ( IO . Swagger . Model . ParameterMeta p in ActionObjectMetadata . Settings ) {
104103 if ( p . Name == id ) {
@@ -109,7 +108,7 @@ public bool TryGetParameterMetadata(string id, out IO.Swagger.Model.ParameterMet
109108 parameterMeta = null ;
110109 return false ;
111110 }
112-
111+
113112 public abstract Vector3 GetScenePosition ( ) ;
114113
115114 public abstract void SetScenePosition ( Vector3 position ) ;
@@ -146,7 +145,7 @@ public bool IsCamera() {
146145 public virtual void DeleteActionObject ( ) {
147146 // Remove all actions of this action point
148147 RemoveActionPoints ( ) ;
149-
148+
150149 // Remove this ActionObject reference from the scene ActionObject list
151150 SceneManager . Instance . ActionObjects . Remove ( this . Data . Id ) ;
152151
@@ -206,7 +205,7 @@ public override string GetName() {
206205 return Data . Name ;
207206 }
208207
209-
208+
210209 public bool IsActionObject ( ) {
211210 return true ;
212211 }
@@ -245,45 +244,45 @@ public async override Task<RequestResult> Movable() {
245244 public abstract void CreateModel ( IO . Swagger . Model . CollisionModels customCollisionModels = null ) ;
246245 public abstract GameObject GetModelCopy ( ) ;
247246
248- public IO . Swagger . Model . Pose GetPose ( ) {
249- if ( ActionObjectMetadata . HasPose )
250- return new IO . Swagger . Model . Pose ( position : DataHelper . Vector3ToPosition ( TransformConvertor . UnityToROS ( transform . localPosition ) ) ,
251- orientation : DataHelper . QuaternionToOrientation ( TransformConvertor . UnityToROS ( transform . localRotation ) ) ) ;
252- else
253- return new IO . Swagger . Model . Pose ( orientation : new IO . Swagger . Model . Orientation ( ) , position : new IO . Swagger . Model . Position ( ) ) ;
254- }
255- public async override Task Rename ( string name ) {
256- try {
257- await WebsocketManager . Instance . RenameObject ( GetId ( ) , name ) ;
258- Notifications . Instance . ShowToastMessage ( "Action object renamed" ) ;
259- } catch ( RequestFailedException e ) {
260- Notifications . Instance . ShowNotification ( "Failed to rename action object" , e . Message ) ;
261- throw ;
247+ public IO . Swagger . Model . Pose GetPose ( ) {
248+ if ( ActionObjectMetadata . HasPose )
249+ return new IO . Swagger . Model . Pose ( position : DataHelper . Vector3ToPosition ( TransformConvertor . UnityToROS ( transform . localPosition ) ) ,
250+ orientation : DataHelper . QuaternionToOrientation ( TransformConvertor . UnityToROS ( transform . localRotation ) ) ) ;
251+ else
252+ return new IO . Swagger . Model . Pose ( orientation : new IO . Swagger . Model . Orientation ( ) , position : new IO . Swagger . Model . Position ( ) ) ;
253+ }
254+ public async override Task Rename ( string name ) {
255+ try {
256+ await WebsocketManager . Instance . RenameObject ( GetId ( ) , name ) ;
257+ Notifications . Instance . ShowToastMessage ( "Action object renamed" ) ;
258+ } catch ( RequestFailedException e ) {
259+ Notifications . Instance . ShowNotification ( "Failed to rename action object" , e . Message ) ;
260+ throw ;
261+ }
262262 }
263- }
264- public async override Task < RequestResult > Removable ( ) {
265- if ( GameManager . Instance . GetGameState ( ) != GameManager . GameStateEnum . SceneEditor ) {
266- return new RequestResult ( false , "Action object could be removed only in scene editor" ) ;
267- } else if ( SceneManager . Instance . SceneStarted ) {
268- return new RequestResult ( false , "Scene online" ) ;
269- } else {
263+ public async override Task < RequestResult > Removable ( ) {
264+ if ( GameManager . Instance . GetGameState ( ) != GameManager . GameStateEnum . SceneEditor ) {
265+ return new RequestResult ( false , "Action object could be removed only in scene editor" ) ;
266+ } else if ( SceneManager . Instance . SceneStarted ) {
267+ return new RequestResult ( false , "Scene online" ) ;
268+ } else {
270269 IO . Swagger . Model . RemoveFromSceneResponse response = await WebsocketManager . Instance . RemoveFromScene ( GetId ( ) , false , true ) ;
271- if ( response . Result )
272- return new RequestResult ( true ) ;
273- else
274- return new RequestResult ( false , response . Messages [ 0 ] ) ;
270+ if ( response . Result )
271+ return new RequestResult ( true ) ;
272+ else
273+ return new RequestResult ( false , response . Messages [ 0 ] ) ;
274+ }
275275 }
276- }
277276
278277
279- public async override void Remove ( ) {
278+ public async override void Remove ( ) {
280279 IO . Swagger . Model . RemoveFromSceneResponse response =
281280 await WebsocketManager . Instance . RemoveFromScene ( GetId ( ) , false , false ) ;
282- if ( ! response . Result ) {
283- Notifications . Instance . ShowNotification ( "Failed to remove object " + GetName ( ) , response . Messages [ 0 ] ) ;
284- return ;
281+ if ( ! response . Result ) {
282+ Notifications . Instance . ShowNotification ( "Failed to remove object " + GetName ( ) , response . Messages [ 0 ] ) ;
283+ return ;
284+ }
285285 }
286- }
287286
288287 public Transform GetSpawnPoint ( ) {
289288 return transform ;
0 commit comments