Inheritance: Engine.Region
Beispiel #1
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate(bool loaded)
        {
            base.OnPostCreate(loaded);

            if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
            {
                const string        regionTypeName = "ManualInfluenceRegion";
                InfluenceRegionType regionType     = (InfluenceRegionType)EntityTypes.Instance.GetByName(
                    regionTypeName);
                if (regionType == null)
                {
                    regionType = (InfluenceRegionType)EntityTypes.Instance.ManualCreateType(
                        regionTypeName,
                        EntityTypes.Instance.GetClassInfoByEntityClassName("InfluenceRegion"));
                    regionType.NetworkType = EntityNetworkTypes.ServerOnly;
                }

                region                  = (InfluenceRegion)Entities.Instance.Create(regionType, Map.Instance);
                region.ShapeType        = Region.ShapeTypes.Capsule;
                region.DistanceFunction = InfluenceRegion.DistanceFunctionType.NormalFadeAxisX;

                region.SetTransform(Position, Rotation, InfluenceRegionScale);
                region.PostCreate();
                region.AllowSave        = false;
                region.EditorSelectable = false;

                bladesMotor = PhysicsModel.GetMotor("bladesMotor") as GearedMotor;
            }

            AddTimer();

            UpdateParticlesForceCoefficient(0);
        }
Beispiel #2
0
 /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
 protected override void OnDestroy()
 {
     if (region != null)
     {
         region.SetShouldDelete();
         region = null;
     }
     base.OnDestroy();
 }
Beispiel #3
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate(bool loaded)
        {
            base.OnPostCreate(loaded);

            if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
            {
                //region
                const string regionTypeName = "ManualInfluenceRegion";

                InfluenceRegionType regionType = (InfluenceRegionType)EntityTypes.Instance.GetByName(
                    regionTypeName);
                if (regionType == null)
                {
                    regionType = (InfluenceRegionType)EntityTypes.Instance.ManualCreateType(
                        regionTypeName,
                        EntityTypes.Instance.GetClassInfoByEntityClassName("InfluenceRegion"));
                    regionType.NetworkType = EntityNetworkTypes.ServerOnly;
                }

                if (Type.Thickness != 0 && Type.Length != 0)
                {
                    region           = (InfluenceRegion)Entities.Instance.Create(regionType, Map.Instance);
                    region.ShapeType = Region.ShapeTypes.Box;
                    UpdateTransform();
                    region.PostCreate();
                    region.AllowSave        = false;
                    region.EditorSelectable = false;
                }
            }

            UpdateMode();

            AddTimer();

            UpdateParticlesForceCoefficient();
        }
Beispiel #4
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate( bool loaded )
        {
            base.OnPostCreate( loaded );

            if( EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle() )
            {
                const string regionTypeName = "ManualInfluenceRegion";
                InfluenceRegionType regionType = (InfluenceRegionType)EntityTypes.Instance.GetByName(
                    regionTypeName );
                if( regionType == null )
                {
                    regionType = (InfluenceRegionType)EntityTypes.Instance.ManualCreateType(
                        regionTypeName,
                        EntityTypes.Instance.GetClassInfoByEntityClassName( "InfluenceRegion" ) );
                    regionType.NetworkType = EntityNetworkTypes.ServerOnly;
                }

                region = (InfluenceRegion)Entities.Instance.Create( regionType, Map.Instance );
                region.ShapeType = Region.ShapeTypes.Capsule;
                region.DistanceFunction = InfluenceRegion.DistanceFunctionType.NormalFadeAxisX;

                region.SetTransform( Position, Rotation, InfluenceRegionScale );
                region.PostCreate();
                region.AllowSave = false;
                region.EditorSelectable = false;

                bladesMotor = PhysicsModel.GetMotor( "bladesMotor" ) as GearedMotor;
            }

            AddTimer();

            UpdateParticlesForceCoefficient( 0 );
        }
Beispiel #5
0
 /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
 protected override void OnDestroy()
 {
     if( region != null )
     {
         region.SetShouldDelete();
         region = null;
     }
     base.OnDestroy();
 }
Beispiel #6
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate( bool loaded )
        {
            base.OnPostCreate( loaded );

            //region
            const string regionTypeName = "ManualInfluenceRegion";

            InfluenceRegionType regionType = (InfluenceRegionType)EntityTypes.Instance.GetByName( regionTypeName );
            if( regionType == null )
            {
                regionType = (InfluenceRegionType)EntityTypes.Instance.ManualCreateType( regionTypeName,
                    EntityTypes.Instance.GetClassInfoByEntityClassName( "InfluenceRegion" ) );
            }

            if( Type.Thickness != 0 && Type.Length != 0 )
            {
                region = (InfluenceRegion)Entities.Instance.Create( regionType, Map.Instance );
                region.ShapeType = Region.ShapeTypes.Box;
                UpdateTransform();
                region.PostCreate();
                region.AllowSave = false;
                region.EditorSelectable = false;
            }

            UpdateMode();

            AddTimer();

            UpdateParticlesForceCoefficient();
        }
Beispiel #7
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate( bool loaded )
        {
            base.OnPostCreate( loaded );

            if( EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle() )
            {
                //region
                const string regionTypeName = "ManualInfluenceRegion";

                InfluenceRegionType regionType = (InfluenceRegionType)EntityTypes.Instance.GetByName(
                    regionTypeName );
                if( regionType == null )
                {
                    regionType = (InfluenceRegionType)EntityTypes.Instance.ManualCreateType(
                        regionTypeName,
                        EntityTypes.Instance.GetClassInfoByEntityClassName( "InfluenceRegion" ) );
                    regionType.NetworkType = EntityNetworkTypes.ServerOnly;
                }

                if( Type.Thickness != 0 && Type.Length != 0 )
                {
                    region = (InfluenceRegion)Entities.Instance.Create( regionType, Map.Instance );
                    region.ShapeType = Region.ShapeTypes.Box;
                    UpdateTransform();
                    region.PostCreate();
                    region.AllowSave = false;
                    region.EditorSelectable = false;
                }
            }

            UpdateMode();

            AddTimer();
        }