コード例 #1
0
 public void AcceptActive()
 {
     if (_activeObject.Accept())
     {
         EditAction editAction;
         toolsPanel.SetActive(false);
         if (!(_activeObject.createdFromPanel))
         {
             editAction = new MoveEditAction(
                 _activeObject.gameObject,
                 new TransformDelta(_activeObject.restTransform, _activeObject.transform)
                 );
         }
         else
         {
             GameObject button = itemsPanel.GetComponent <ItemsPanel>().GetOrCreateButton(_activeObject.gameObject);
             button.GetComponent <ItemCreator>().DecrementAndCreate();
             editAction = new CreateEditAction(
                 _activeObject.gameObject,
                 button
                 );
             _activeObject.createdFromPanel = false;
         }
         _history.Add(editAction);
         if (_activeObject.movableObjectType == MovableObjectType.Gravity)
         {
             _activeObject.GetComponent <SimulationObject>().enabled = true;
             _activeObject.GetComponent <SimulationObject>().UpdateRest();
         }
         _activeObject.restTransform.copyFrom(_activeObject.transform);
         _activeObject.controller.toolMode = 0;
         _activeObject = null;
     }
     else
     {
         Debug.Log("Bad Position");
     }
 }