Exemplo n.º 1
0
        public override bool Rollback()
        {
            if (!base.Rollback())
            {
                return(false);
            }

            if (m_prefab == null)
            {
                Debug.LogError("LE_CmdDeleteObject: Rollback: could not rollback, m_prefab is null!");
                return(false);
            }

            if (m_gui3d == null)
            {
                Debug.LogError("LE_CmdDeleteObject: Rollback: could not rollback, m_gui3d is null!");
                return(false);
            }

            m_objectInstance.Obj = LE_LogicObjects.InstantiateObject(m_prefab, m_position, m_rotation, m_scale, m_objectResourcePath);
            m_objectInstance.UID = m_UID;
            m_objectInstance.Obj.IsRigidbodySleepingStart = m_isRigidbodySleepingStart;
            m_objectInstance.Obj.DeactivateRigidbody();             // no collision solving needed
            LE_LogicObjects.ApplyColor(m_objectInstance.Obj, m_color);
            LE_LogicObjects.ApplyVariation(m_objectInstance.Obj, m_variationIndex);
            // load snap points that were connected before deleting
            m_gui3d.SetSnapPointUIDsToObjUIDsAndApplyChanges(m_snapPointLinks);
            LE_LogicObjects.AddSnappingScripts(m_gui3d, m_objectInstance.Obj);
            LE_LogicObjects.SelectNewObjectAndNotifyListeners(m_gui3d, m_objectInstance.Obj);

            return(true);
        }
Exemplo n.º 2
0
        private bool Apply(int p_variationIndex)
        {
            if (m_object.Obj == null)
            {
                Debug.LogError("LE_CmdChangeObjectVariation: Execute: could not execute, m_object is null!");
                return(false);
            }

            if (m_variationIndexBefore == -10)
            {
                m_variationIndexBefore = m_object.Obj.VariationsDefaultIndex;
            }

            LE_LogicObjects.ApplyVariation(m_object.Obj, p_variationIndex);

            return(true);
        }