Esempio n. 1
0
        private void OnPreviewObjectInstantiated(object p_sender, S_SnapToObjectEventArgs p_args)
        {
            LE_Object leObj = p_args.NewInstance.GetComponent <LE_Object>();

            if (leObj != null)
            {
                Destroy(leObj);
            }
        }
Esempio n. 2
0
        private void OnAfterObjectSnapped(object p_sender, S_SnapToObjectEventArgs p_args)
        {
            if (m_gui3d == null)
            {
                Debug.LogError("LE_CmdSnapObjectToObject: OnAfterObjectSnapped: m_gui3d is null!");
                return;
            }

            LE_Object newObj = p_args.NewInstance.GetComponent <LE_Object>();

            if (newObj != null)
            {
                if (m_snappedObj.UID > 0)
                {
                    newObj.UID = m_snappedObj.UID;                     // reuse snap object UID of the first creation
                }
                m_snappedObj.Obj = newObj;
                LE_LogicObjects.OnNewObjectSnapped(m_gui3d, newObj, p_args);
            }
            else
            {
                Debug.LogError("LE_CmdSnapObjectToObject: OnAfterObjectSnapped: LE_Object is not attached to the root of the new object! This object will not be saved if it has no LE_Object attached!");
            }
        }
Esempio n. 3
0
// STATIC LOGIC -------------------------------------------------------------------------------------------------------------------

        public static void OnNewObjectSnapped(LE_GUI3dObject p_gui3d, LE_Object p_newObject, S_SnapToObjectEventArgs p_args)
        {
            if (p_newObject != null)
            {
                LE_Object sourceObj      = p_args.Source.GetComponentInParent <LE_Object>();
                LE_Object destinationObj = p_args.NewInstance.GetComponent <LE_Object>();
                // mark source snap point as used
                p_gui3d.MarkSnapPointAsUsed(sourceObj, destinationObj, p_args.Source);
                // mark destination snap point as used
                if (destinationObj.RootSnapPointIndex != -1)
                {
                    p_gui3d.MarkSnapPointAsUsed(destinationObj, sourceObj, destinationObj.RootSnapPointIndex);
                }
                // setup new object
                OnNewObjectPlaced(p_gui3d, p_newObject);
            }
        }