当前位置: 首页>>代码示例>>C#>>正文


C# BaseEntity.ToPlayer方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:nevadascout,项目名称:RustFactionsPublic,代码行数:13,代码来源:GatherLevels2.cs

示例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);
        }
开发者ID:nevadascout,项目名称:RustFactionsPublic,代码行数:48,代码来源:GatherLevels.cs

示例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);
        }
开发者ID:nevadascout,项目名称:RustFactionsPublic,代码行数:9,代码来源:GatherLevelsNoBadlands.cs

示例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);
 }
开发者ID:Zloplay,项目名称:hunt,代码行数:40,代码来源:HuntRPG.cs


注:本文中的BaseEntity.ToPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。