本文整理汇总了C#中MiNET.Player.SetEffect方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SetEffect方法的具体用法?C# Player.SetEffect怎么用?C# Player.SetEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiNET.Player
的用法示例。
在下文中一共展示了Player.SetEffect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RespawnHandler
public Package RespawnHandler(McpeRespawn packet, Player player)
{
player.RemoveAllEffects();
player.SetEffect(new Speed { Level = 2, Duration = 1000 });
////player.SetEffect(new Slowness {Level = 2, Duration = 20});
//player.SetEffect(new JumpBoost { Level = 2, Duration = Effect.MaxDuration });
//player.SetAutoJump(true);
if (player.Level.LevelId.Equals("Default"))
{
player.Level.CurrentWorldTime = 6000;
player.Level.IsWorldTimeStarted = false;
}
player.SendSetTime();
return packet;
}
示例2: Effect
public void Effect(Player player, string effect, int level = 1, int duration = 20)
{
EffectType effectType;
if (Enum.TryParse(effect, true, out effectType))
{
Effect eff = null;
switch (effectType)
{
case EffectType.Speed:
eff = new Speed();
break;
case EffectType.Slowness:
eff = new Slowness();
break;
case EffectType.Haste:
eff = new Haste();
break;
case EffectType.MiningFatigue:
eff = new MiningFatigue();
break;
case EffectType.Strenght:
eff = new Strength();
break;
case EffectType.InstandHealth:
eff = new InstandHealth();
break;
case EffectType.InstantDamage:
eff = new InstantDamage();
break;
case EffectType.JumpBoost:
eff = new JumpBoost();
break;
case EffectType.Nausea:
eff = new Nausea();
break;
case EffectType.Regeneration:
eff = new Regeneration();
break;
case EffectType.Resistance:
eff = new Resistance();
break;
case EffectType.FireResistance:
eff = new FireResistance();
break;
case EffectType.WaterBreathing:
eff = new WaterBreathing();
break;
case EffectType.Invisibility:
eff = new Invisibility();
break;
case EffectType.Blindness:
eff = new Blindness();
break;
case EffectType.NightVision:
eff = new NightVision();
break;
case EffectType.Hunger:
eff = new Hunger();
break;
case EffectType.Weakness:
eff = new Weakness();
break;
case EffectType.Poison:
eff = new Poison();
break;
case EffectType.Wither:
eff = new Wither();
break;
case EffectType.HealthBoost:
eff = new HealthBoost();
break;
case EffectType.Absorption:
eff = new Absorption();
break;
case EffectType.Saturation:
eff = new Saturation();
break;
case EffectType.Glowing:
eff = new Glowing();
break;
case EffectType.Levitation:
eff = new Levitation();
break;
}
if (eff != null)
{
eff.Level = level;
eff.Duration = duration;
eff.Particles = false;
player.SetEffect(eff);
player.Level.BroadcastMessage(string.Format("{0} added effect {1} with strenght {2}", player.Username, effectType, level), MessageType.Raw);
}
}
}
示例3: RespawnHandler
public Package RespawnHandler(McpeRespawn packet, Player player)
{
SendNameTag(player);
player.RemoveAllEffects();
player.SetEffect(new Speed {Level = 1, Duration = Effect.MaxDuration}); // 10s in ticks
//player.SetEffect(new Slowness { Level = 20, Duration = 20 * 10 });
//player.SetEffect(new Haste { Level = 20, Duration = 20 * 10 });
//player.SetEffect(new MiningFatigue { Level = 20, Duration = 20 * 10 });
//player.SetEffect(new Strength { Level = 20, Duration = 20 * 10 });
player.SetEffect(new JumpBoost {Level = 1, Duration = Effect.MaxDuration});
//player.SetEffect(new Blindness { Level = 20, Duration = 20 * 10 });
//player.SetAutoJump(true);
if (player.Level.LevelId.Equals("Default"))
{
player.Level.CurrentWorldTime = 6000;
player.Level.IsWorldTimeStarted = false;
}
player.SendSetTime();
return packet;
}
示例4: Effect
public void Effect(Player player, string effect, int level, int duration)
{
if ("clear".Equals(effect, StringComparison.InvariantCultureIgnoreCase))
{
player.Level.BroadcastMessage($"Removed all effects for {player.Username}.", MessageType.Raw);
player.RemoveAllEffects();
return;
}
EffectType effectType;
if (Enum.TryParse(effect, true, out effectType))
{
Effect eff = null;
switch (effectType)
{
case EffectType.Speed:
eff = new Speed();
break;
case EffectType.Slowness:
eff = new Slowness();
break;
case EffectType.Haste:
eff = new Haste();
break;
case EffectType.MiningFatigue:
eff = new MiningFatigue();
break;
case EffectType.Strength:
eff = new Strength();
break;
case EffectType.InstantHealth:
eff = new InstantHealth();
break;
case EffectType.InstantDamage:
eff = new InstantDamage();
break;
case EffectType.JumpBoost:
eff = new JumpBoost();
break;
case EffectType.Nausea:
eff = new Nausea();
break;
case EffectType.Regeneration:
eff = new Regeneration();
break;
case EffectType.Resistance:
eff = new Resistance();
break;
case EffectType.FireResistance:
eff = new FireResistance();
break;
case EffectType.WaterBreathing:
eff = new WaterBreathing();
break;
case EffectType.Invisibility:
eff = new Invisibility();
break;
case EffectType.Blindness:
eff = new Blindness();
break;
case EffectType.NightVision:
eff = new NightVision();
break;
case EffectType.Hunger:
eff = new Hunger();
break;
case EffectType.Weakness:
eff = new Weakness();
break;
case EffectType.Poison:
eff = new Poison();
break;
case EffectType.Wither:
eff = new Wither();
break;
case EffectType.HealthBoost:
eff = new HealthBoost();
break;
case EffectType.Absorption:
eff = new Absorption();
break;
case EffectType.Saturation:
eff = new Saturation();
break;
}
if (eff != null)
{
eff.Level = level;
eff.Duration = duration;
eff.Particles = false;
player.SetEffect(eff);
player.Level.BroadcastMessage($"{player.Username} added effect {effectType} with strenght {level}", MessageType.Raw);
}
}
}