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


C# Player.GetToolCooldown方法代码示例

本文整理汇总了C#中Infiniminer.Player.GetToolCooldown方法的典型用法代码示例。如果您正苦于以下问题:C# Player.GetToolCooldown方法的具体用法?C# Player.GetToolCooldown怎么用?C# Player.GetToolCooldown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Infiniminer.Player的用法示例。


在下文中一共展示了Player.GetToolCooldown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UsePickaxe

        public void UsePickaxe(Player player, Vector3 playerPosition, Vector3 playerHeading)
        {
            player.QueueAnimationBreak = true;

            // Figure out what we're hitting.
            Vector3 hitPoint = Vector3.Zero;
            Vector3 buildPoint = Vector3.Zero;

            if (artifactActive[(byte)player.Team, 4] > 0 || player.Content[10] == 4)
            {
                if (!RayCollision(playerPosition, playerHeading, 2, 10, ref hitPoint, ref buildPoint, BlockType.Water))
                {
                    //ConsoleWrite(player.Handle + " lost a block sync.");
                    return;
                }
            }
            else
            {
                if (!RayCollision(playerPosition, playerHeading, 2, 10, ref hitPoint, ref buildPoint, BlockType.None))
                {
                    //ConsoleWrite(player.Handle + " lost a block sync.");
                    return;
                }
            }
            ushort x = (ushort)hitPoint.X;
            ushort y = (ushort)hitPoint.Y;
            ushort z = (ushort)hitPoint.Z;

            if (player.Alive == false || player.playerToolCooldown > DateTime.Now)
            {
                //ConsoleWrite("fixed " + player.Handle + " synchronization");
                SetBlockForPlayer(x, y, z, blockList[x, y, z], blockCreatorTeam[x, y, z], player);
                return;
            }
            else
            {
                player.playerToolCooldown = DateTime.Now + TimeSpan.FromSeconds((float)(player.GetToolCooldown(PlayerTools.Pickaxe)));
            }
            // Figure out what the result is.
            bool removeBlock = false;
            uint giveOre = 0;
            uint giveCash = 0;
            uint giveWeight = 0;
            int Damage = 2 + ResearchComplete[(byte)player.Team, 5];
            InfiniminerSound sound = InfiniminerSound.DigDirt;
            BlockType block = BlockAtPoint(hitPoint);
            switch (block)
            {
                case BlockType.Lava:
                    if (varGetB("minelava"))
                    {
                        removeBlock = true;
                        sound = InfiniminerSound.DigDirt;
                    }
                    break;
                case BlockType.Water:
                    if (varGetB("minelava"))
                    {
                        removeBlock = true;
                        sound = InfiniminerSound.DigDirt;
                    }
                    break;
                case BlockType.Dirt:
                case BlockType.Mud:
                case BlockType.Grass:
                case BlockType.Sand:
                case BlockType.DirtSign:
                    removeBlock = true;
                    sound = InfiniminerSound.DigDirt;
                    break;
                case BlockType.StealthBlockB:
                    removeBlock = true;
                    sound = InfiniminerSound.DigDirt;
                    break;
                case BlockType.StealthBlockR:
                    removeBlock = true;
                    sound = InfiniminerSound.DigDirt;
                    break;
                case BlockType.TrapB:
                    removeBlock = true;
                    sound = InfiniminerSound.DigDirt;
                    break;
                case BlockType.TrapR:
                    removeBlock = true;
                    sound = InfiniminerSound.DigDirt;
                    break;
                case BlockType.Ore:
                    removeBlock = true;
                    giveOre = 20;
                    sound = InfiniminerSound.DigMetal;
                    break;

                case BlockType.Gold:
                    Damage = 2;
                    giveWeight = 1;
                    giveCash = 10;
                    sound = InfiniminerSound.DigMetal;
                    break;

                case BlockType.Diamond:
//.........这里部分代码省略.........
开发者ID:bobisfat,项目名称:Infiniminer,代码行数:101,代码来源:InfiniminerServer.cs

示例2: ThrowRope

        //private bool LocationNearBase(ushort x, ushort y, ushort z)
        //{
        //    for (int i=0; i<MAPSIZE; i++)
        //        for (int j=0; j<MAPSIZE; j++)
        //            for (int k = 0; k < MAPSIZE; k++)
        //                if (blockList[i, j, k] == BlockType.HomeBlue || blockList[i, j, k] == BlockType.HomeRed)
        //                {
        //                    double dist = Math.Sqrt(Math.Pow(x - i, 2) + Math.Pow(y - j, 2) + Math.Pow(z - k, 2));
        //                    if (dist < 3)
        //                        return true;
        //                }
        //    return false;
        //}
        public void ThrowRope(Player player, Vector3 playerPosition, Vector3 playerHeading)
        {
            bool actionFailed = false;

            if (player.Alive == false || player.playerToolCooldown > DateTime.Now)
            {
                actionFailed = true;
            }
            else if (player.Ore > 49)
            {
                player.Ore -= 50;
                SendOreUpdate(player);
            }
            else
            {
                actionFailed = true;
            }
            // If there's no surface within range, bail.
            Vector3 hitPoint = playerPosition;
            Vector3 buildPoint = playerPosition;
            Vector3 exactPoint = playerPosition;

            ushort x = (ushort)buildPoint.X;
            ushort y = (ushort)buildPoint.Y;
            ushort z = (ushort)buildPoint.Z;

            if (x <= 0 || y <= 0 || z <= 0 || (int)x > MAPSIZE - 1 || (int)y > MAPSIZE - 1 || (int)z > MAPSIZE - 1)
                actionFailed = true;

            if (blockList[(ushort)hitPoint.X, (ushort)hitPoint.Y, (ushort)hitPoint.Z] == BlockType.Lava || blockList[(ushort)hitPoint.X, (ushort)hitPoint.Y, (ushort)hitPoint.Z] == BlockType.Water)
                actionFailed = true;

            if (actionFailed)
            {
                // Decharge the player's gun.
                //    TriggerConstructionGunAnimation(player, -0.2f);
            }
            else
            {
                player.playerToolCooldown = DateTime.Now + TimeSpan.FromSeconds((float)(player.GetToolCooldown(PlayerTools.ThrowRope)));
                // Fire the player's gun.
                //    TriggerConstructionGunAnimation(player, 0.5f);

                // Build the block.
                //hitPoint = RayCollision(playerPosition, playerHeading, 6, 25, ref hitPoint, ref buildPoint, 1);

                exactPoint.Y = exactPoint.Y + (float)0.25;//0.25 = items height

                uint ii = SetItem(ItemType.Rope, exactPoint, playerHeading, playerHeading * 5, player.Team, 0);
                itemList[ii].Content[6] = (byte)player.Team;//set teamsafe
                // player.Ore -= blockCost;
                // SendResourceUpdate(player);

                // Play the sound.
                PlaySound(InfiniminerSound.ConstructionGun, player.Position);
            }
        }
开发者ID:bobisfat,项目名称:Infiniminer,代码行数:70,代码来源:InfiniminerServer.cs


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