/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
public void StringReversedAndThenReversedAgainIsSameAsOriginalString() { Check.One(MyConfig, PropFunc.FromConverter(s => s.Reverse().Reverse() == s)); }