예제 #1
0
        private void RemoveGroup(CollisionGroupEntry entry, Find.LeafData data)
        {
            foreach (Collide.Shape shape in data.Shapes)
            {
                if (shape.GetInitialized <Collide.Shape>() != null)
                {
                    entry.RemoveFrom(shape.NativeGeometry);
                }
            }

            foreach (Wire wire in data.Wires)
            {
                if (wire.GetInitialized <Wire>() != null)
                {
                    entry.RemoveFrom(wire.Native);
                }
            }

            foreach (Cable cable in data.Cables)
            {
                if (cable.GetInitialized <Cable>() != null)
                {
                    cable.GetInitialized <Cable>().Native.removeGroup(entry.Tag.To32BitFnv1aHash());
                }
            }
        }
        protected override void OnDestroy()
        {
            m_objects    = null;
            m_parameters = null;

            base.OnDestroy();
        }
예제 #3
0
        /// <summary>
        /// Initialize, finds supported object and executes addGroup to it.
        /// </summary>
        protected override bool Initialize()
        {
            if (m_groups.Count == 0)
            {
                return(base.Initialize());
            }

            var data = new Find.LeafData[] { Find.LeafObjects(gameObject, false), Find.LeafObjects(gameObject, true) };

            foreach (var entry in m_groups)
            {
                AddGroup(entry, data[Convert.ToInt32(entry.PropagateToChildren)]);
            }

            return(base.Initialize());
        }
        protected override bool Initialize()
        {
            if (!WindAndWaterManager.HasInstance)
            {
                return(false);
            }

            m_objects    = Find.LeafObjects(gameObject, PropagateToChildren);
            m_parameters = new List <T>();

            AddParameters <Collide.Shape, agxCollide.Shape>(m_objects.Shapes, shape => shape.NativeShape);
            AddParameters <Wire, agxWire.Wire>(m_objects.Wires, wire => wire.Native);
            AddParameters <Cable, agxCable.Cable>(m_objects.Cables, cable => cable.Native);

            return(true);
        }
예제 #5
0
        private void RemoveGroup(CollisionGroupEntry entry, Find.LeafData data)
        {
            foreach (var shape in data.Shapes)
            {
                if (shape.GetInitialized <Collide.Shape>() != null)
                {
                    entry.RemoveFrom(shape.NativeGeometry);
                }
            }

            foreach (var wire in data.Wires)
            {
                if (wire.GetInitialized <Wire>() != null)
                {
                    entry.RemoveFrom(wire.Native);
                }
            }

            foreach (var cable in data.Cables)
            {
                if (cable.GetInitialized <Cable>() != null)
                {
                    entry.RemoveFrom(cable.Native);
                }
            }

            foreach (var track in data.Tracks)
            {
                if (track.GetInitialized <Model.Track>() != null)
                {
                    entry.RemoveFrom(track.Native);
                }
            }

            foreach (var terrain in data.Terrains)
            {
                if (terrain.GetInitialized <Model.DeformableTerrain>() != null)
                {
                    entry.RemoveFrom(terrain.Native.getGeometry());
                }
            }
        }