Ejemplo n.º 1
0
        /// <summary>
        /// Register as listener of these settings. Current settings will
        /// be applied to the shovel instance directly when added.
        /// </summary>
        /// <param name="shovel">Deformable shovel instance to which these settings should apply.</param>
        public void Register(DeformableTerrainShovel shovel)
        {
            if (!m_shovels.Contains(shovel))
            {
                m_shovels.Add(shovel);
            }

            Synchronize(shovel);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Explicit synchronization of all properties to the given
 /// terrain shovel instance.
 /// </summary>
 /// <remarks>
 /// This call wont have any effect unless the native instance
 /// of the shovel has been created.
 /// </remarks>
 /// <param name="shovel">Terrain shovel instance to synchronize.</param>
 public void Synchronize(DeformableTerrainShovel shovel)
 {
     try {
         m_singleSynchronizeInstance = shovel;
         Utils.PropertySynchronizer.Synchronize(this);
     }
     finally {
         m_singleSynchronizeInstance = null;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Register as listener of these settings. Current settings will
        /// be applied to the shovel instance directly when added.
        /// </summary>
        /// <param name="shovel">Deformable shovel instance to which these settings should apply.</param>
        public void Register(DeformableTerrainShovel shovel)
        {
            if (!m_shovels.Contains(shovel))
            {
                m_shovels.Add(shovel);

                // Synchronizing settings for all shovels. Could be
                // avoided by adding a state so that Propagate only
                // shows current added shovel.
                Utils.PropertySynchronizer.Synchronize(this);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Disassociate shovel instance to this terrain.
        /// </summary>
        /// <param name="shovel">Shovel instance to remove.</param>
        /// <returns>True if removed, false if null or not associated to this terrain.</returns>
        public bool Remove(DeformableTerrainShovel shovel)
        {
            if (shovel == null || !m_shovels.Contains(shovel))
            {
                return(false);
            }

            if (Native != null)
            {
                Native.remove(shovel.Native);
            }

            return(m_shovels.Remove(shovel));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Associate shovel instance to this terrain.
        /// </summary>
        /// <param name="shovel">Shovel instance to add.</param>
        /// <returns>True if added, false if null or already added.</returns>
        public bool Add(DeformableTerrainShovel shovel)
        {
            if (shovel == null || m_shovels.Contains(shovel))
            {
                return(false);
            }

            m_shovels.Add(shovel);

            // Initialize shovel if we're initialized.
            if (Native != null)
            {
                Native.add(shovel.GetInitialized <DeformableTerrainShovel>().Native);
            }

            return(true);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Unregister as listener of these settings.
 /// </summary>
 /// <param name="shovel"></param>
 public void Unregister(DeformableTerrainShovel shovel)
 {
     m_shovels.Remove(shovel);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Find if shovel has been associated to this terrain.
 /// </summary>
 /// <param name="shovel">Shovel instance to check.</param>
 /// <returns>True if associated, otherwise false.</returns>
 public bool Contains(DeformableTerrainShovel shovel)
 {
     return(shovel != null && m_shovels.Contains(shovel));
 }