本文整理汇总了C#中BaseEntity.ToPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# BaseEntity.ToPlayer方法的具体用法?C# BaseEntity.ToPlayer怎么用?C# BaseEntity.ToPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseEntity
的用法示例。
在下文中一共展示了BaseEntity.ToPlayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDispenserGather
/// <summary>
/// Increase gather rates from trees, ores, animals, etc
/// </summary>
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
{
var player = entity.ToPlayer();
if (player == null) return;
if (this.IsInBadlands(player))
{
item.amount = Convert.ToInt32(item.amount * 3);
}
}
示例2: OnDispenserGather
/// <summary>
/// Increase gather rates from trees, ores, animals, etc
/// </summary>
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
{
var player = entity.ToPlayer();
if (player == null) return;
var rateMultipliers = this.GetRateMultipliers(player);
float multiplier;
switch (dispenser.gatherType)
{
case ResourceDispenser.GatherType.Tree:
multiplier = rateMultipliers.Tree;
// Increase gather rate
rateMultipliers.Tree = this.IncreaseRate(rateMultipliers.Tree);
break;
case ResourceDispenser.GatherType.Ore:
multiplier = rateMultipliers.Ore;
// Increase gather rate
rateMultipliers.Ore = this.IncreaseRate(rateMultipliers.Ore);
break;
case ResourceDispenser.GatherType.Flesh:
multiplier = rateMultipliers.Flesh;
// Increase gather rate
rateMultipliers.Flesh = this.IncreaseRate(rateMultipliers.Flesh);
break;
default:
multiplier = rateMultipliers.Other;
// Increase gather rate
rateMultipliers.Other = this.IncreaseRate(rateMultipliers.Other);
break;
}
// Apply rate multiplier
item.amount = Convert.ToInt32(item.amount * multiplier);
// Save changes made to rate multipliers
this.SaveRateMultipliers(player.userID, rateMultipliers);
}
示例3: OnDispenserGather
/// <summary>
/// Increase gather rates from trees, ores, animals, etc
/// </summary>
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
{
if (entity.ToPlayer() == null) return;
item.amount = Convert.ToInt32(item.amount * 2);
}
示例4: OnGather
public void OnGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
{
BasePlayer player = entity.ToPlayer();
if (player == null) return;
var gatherType = dispenser.gatherType;
RPGInfo rpgInfo = RPGInfo(player);
int experience = item.amount;
if (rpgInfo == null) return;
if (gatherType == ResourceDispenser.GatherType.Tree)
{
if (rpgInfo.Skills.ContainsKey(HRK.LumberJack))
{
var modifier = SkillTable[HRK.LumberJack].Modifiers[HRK.GatherModifier];
int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.LumberJack], Convert.ToInt32(modifier.Args[0]), item.amount);
item.amount = newAmount;
}
experience = item.amount;
}
if (gatherType == ResourceDispenser.GatherType.Ore)
{
if (rpgInfo.Skills.ContainsKey(HRK.Miner))
{
var modifier = SkillTable[HRK.Miner].Modifiers[HRK.GatherModifier];
int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.Miner], Convert.ToInt32(modifier.Args[0]), item.amount);
item.amount = newAmount;
}
experience = (int) ((float)item.amount/3);
}
if (gatherType == ResourceDispenser.GatherType.Flesh)
{
if (rpgInfo.Skills.ContainsKey(HRK.Hunter))
{
var modifier = SkillTable[HRK.Hunter].Modifiers[HRK.GatherModifier];
int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.Hunter], Convert.ToInt32(modifier.Args[0]), item.amount);
item.amount = newAmount;
}
experience = item.amount * 5;
}
ExpGain(rpgInfo, experience, player);
}