Ejemplo n.º 1
0
        /// <summary>
        /// Sets behavior for the prop with entityId.
        /// </summary>
        /// <returns>Prop that the behavior was added for.</returns>
        protected Prop SetPropBehavior(long entityId, PropFunc behavior)
        {
            var prop = ChannelServer.Instance.World.GetProp(entityId);

            if (prop == null)
            {
                Log.Error("{1}.SetPropBehavior: Prop '{0:X16}' doesn't exist.", entityId, this.GetType().Name);
                return(null);
            }

            prop.Behavior = behavior;

            return(prop);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Spawns prop
        /// </summary>
        /// <returns>Created prop.</returns>
        protected Prop SpawnProp(Prop prop, PropFunc behavior = null)
        {
            var region = ChannelServer.Instance.World.GetRegion(prop.RegionId);

            if (region == null)
            {
                Log.Error("{1}.SpawnProp: Region '{0}' doesn't exist.", prop.RegionId, this.GetType().Name);
                return(null);
            }

            prop.Behavior = behavior;

            region.AddProp(prop);

            return(prop);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates prop and spawns it.
 /// </summary>
 /// <returns>Created prop.</returns>
 protected Prop SpawnProp(int id, int regionId, int x, int y, float direction, PropFunc behavior = null)
 {
     return(this.SpawnProp(id, regionId, x, y, direction, 1, behavior));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates prop and spawns it.
        /// </summary>
        /// <returns>Created prop.</returns>
        protected Prop SpawnProp(int id, int regionId, int x, int y, float direction, float scale, PropFunc behavior = null)
        {
            var region = ChannelServer.Instance.World.GetRegion(regionId);

            if (region == null)
            {
                Log.Error("{1}.SpawnProp: Region '{0}' doesn't exist.", regionId, this.GetType().Name);
                return(null);
            }

            var prop = new Prop(id, regionId, x, y, direction, scale);

            prop.Behavior = behavior;

            region.AddProp(prop);

            return(prop);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Spawns prop
        /// </summary>
        protected Prop SpawnProp(Prop prop, PropFunc behavior = null)
        {
            var region = ChannelServer.Instance.World.GetRegion(prop.RegionId);
            if (region == null)
            {
                Log.Error("{1}.SpawnProp: Region '{0}' doesn't exist.", prop.RegionId, this.GetType().Name);
                return null;
            }

            prop.Behavior = behavior;

            region.AddProp(prop);

            return prop;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates prop and spawns it.
        /// </summary>
        protected Prop SpawnProp(int id, int regionId, int x, int y, float direction, PropFunc behavior = null)
        {
            var region = ChannelServer.Instance.World.GetRegion(regionId);
            if (region == null)
            {
                Log.Error("{1}.SpawnProp: Region '{0}' doesn't exist.", regionId, this.GetType().Name);
                return null;
            }

            var prop = new Prop(id, regionId, x, y, direction);
            prop.Behavior = behavior;

            region.AddProp(prop);

            return prop;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets behavior for the prop with entityId.
        /// </summary>
        protected Prop SetPropBehavior(long entityId, PropFunc behavior)
        {
            var prop = ChannelServer.Instance.World.GetProp(entityId);
            if (prop == null)
            {
                Log.Error("{1}.SetPropBehavior: Prop '{0}' doesn't exist.", entityId.ToString("X16"), this.GetType().Name);
                return null;
            }

            prop.Behavior = behavior;

            return prop;
        }
Ejemplo n.º 8
0
 public void StringReversedAndThenReversedAgainIsSameAsOriginalString()
 {
     Check.One(MyConfig, PropFunc.FromConverter(s => s.Reverse().Reverse() == s));
 }