• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Player类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: NewGame

    //Method to be re written when serialisation/deserialisation implemented.
    public Game NewGame(Player newPlayer)
    {
        Game game = new Game(newPlayer);

        GameObject mayorSpawn = GameObject.Find("MayorSpawnLocation-Beach");
        GameObject ethanSpawn = GameObject.Find("EthanSpawnLocation-Hut");
        GameObject jennaSpawn = GameObject.Find("JennaSpawnPoint-forest");
        GameObject fisherSpawn = GameObject.Find("FisherSpawnPoint-headland");

        Npc mayor = new Npc("Mayor", "Mayor", mayorSpawn.transform.position, 1f, true);
        Npc ethan = new Npc("Ethan", "Ethan", ethanSpawn.transform.position, 0.2f, true);
        Npc jenna = new Npc("Jenna", "npc1", jennaSpawn.transform.position,0.3f, true);
        Npc fisher = new Npc("Fisher", "fisher", fisherSpawn.transform.position,0f, false);

        game.AddNpc(mayor);
        game.AddNpc(ethan);
        game.AddNpc(jenna);
        game.AddNpc(fisher);

        RecyclePoint beachPoint = new RecyclePoint("BeachRecyclePoint", 50);
        game.RecyclePoints.Add(beachPoint);

        game.CheckPoints.Add ("SpokenToMayorFirst");
        game.CheckPoints.Add ("SpokenToEthan");
        game.CheckPoints.Add ("FirstEthanMeetingPositive");
        game.CheckPoints.Add ("MayorLeaveBeach");
        game.CheckPoints.Add ("BeachRecyclePointFull");
        game.CheckPoints.Add ("StartSortingMiniGame");

        game.IsNewGame = false;
        return game;
    }
开发者ID:ocoulson,项目名称:MScProjectUnity,代码行数:33,代码来源:GameManager.cs


示例2: IsInRange

        public static bool IsInRange(Player p, Item i, int range)
        {
            int fromX = (int)(p.X * 32.0);
            int fromZ = (int)(p.Z * 32.0);

            return IsInRange(fromX, fromZ, i.X, i.Z, range);
        }
开发者ID:Smjert,项目名称:CXMineServer,代码行数:7,代码来源:Utility.cs


示例3: CreatePlayer

        public static Player CreatePlayer(bool baseStatsOnly = false)
        {
            var player = new Player();
            if (baseStatsOnly)
            {
                player.Str = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_STR"]);
                player.Acc = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_ACC"]);
                player.Crt = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_CRT"]);
                player.Det = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_DET"]);
                player.Sks = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_SKS"]);
            }
            else
            {
                player.Str = Convert.ToDouble(ConfigurationManager.AppSettings["STR"]);
                player.Crt = Convert.ToDouble(ConfigurationManager.AppSettings["CRT"]);
                player.Det = Convert.ToDouble(ConfigurationManager.AppSettings["DET"]);
                player.Sks = Convert.ToDouble(ConfigurationManager.AppSettings["SKS"]);
                player.Weapon = new Weapon
                {
                    WeaponDamage = Convert.ToDouble(ConfigurationManager.AppSettings["WD"]),
                    AutoAttack = Convert.ToDouble(ConfigurationManager.AppSettings["AA"]),
                    Delay = Convert.ToDouble(ConfigurationManager.AppSettings["AA_DELAY"])
                };
            }

            return player;
        }
开发者ID:ThePeterLuu,项目名称:Dragoon-Simulator,代码行数:27,代码来源:PlayerFactory.cs


示例4: Main

        /// <summary>
        /// Main program that executes when it starts
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var user = new Player();
            user.UniqueIdentifier = Guid.NewGuid();
            System.Console.WriteLine("Hello! Please enter your name.");
            var userInput = System.Console.ReadLine();
            user.UserName = userInput;
            System.Console.WriteLine("1. Join the game");
            System.Console.WriteLine("2. Watch the game");
            System.Console.WriteLine("3. Leave the game");
            System.Console.WriteLine("Please select {1, 2, 3 or quit to terminate} : ");

            // loop continusly check user input
            while (!(userInput = System.Console.ReadLine()).ToLower().Equals("quit"))
            {
                switch (userInput)
                {
                    case "1":
                        Proxy.JoinGame(user);
                        break;
                    case "2":
                        Proxy.WatchGame(user);
                        break;
                    case "3":
                        Proxy.QuitGame(user);
                        break;
                    case "quit":
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:Danny417,项目名称:Poker,代码行数:37,代码来源:Program.cs


示例5: SpawnPlayer

    public void SpawnPlayer(Player player)
    {
        player.RespawnAt(transform);

        foreach (var listener in listeners)
            listener.OnPlayerRespawnInThisCheckpoint(this, player);
    }
开发者ID:Wikzo,项目名称:WeekGames,代码行数:7,代码来源:Checkpoint.cs


示例6: Use

 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         if (!Server.voting)
         {
             string temp = message.Substring(0, 1) == "%" ? "" : Server.DefaultColor;
             Server.voting = true;
             Server.NoVotes = 0;
             Server.YesVotes = 0;
             Player.GlobalMessage(" " + c.green + "VOTE: " + temp + message + "(" + c.green + "Yes " + Server.DefaultColor + "/" + c.red + "No" + Server.DefaultColor + ")");
             System.Threading.Thread.Sleep(15000);
             Server.voting = false;
             Player.GlobalMessage("The vote is in! " + c.green + "Y: " + Server.YesVotes + c.red + " N: " + Server.NoVotes);
             Player.players.ForEach(delegate(Player winners)
             {
                 winners.voted = false;
             });
         }
         else
         {
             p.SendMessage("A vote is in progress!");
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:B00mX0r,项目名称:MCForge-MCLawl,代码行数:29,代码来源:CmdVote.cs


示例7: BlankMessage

 //Yes this does work
 //Trust me...I'm a doctor
 public void BlankMessage(Player p)
 {
     byte[] buffer = new byte[65];
     Player.StringFormat(" ", 64).CopyTo(buffer, 1);
     p.SendRaw(OpCode.Message, buffer);
     buffer = null;
 }
开发者ID:NorthPL,项目名称:MCForge-Vanilla-Redux,代码行数:9,代码来源:CmdPlayerCLS.cs


示例8: Use

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            if (message.IndexOf(' ') == -1) message = message + " 60";

            Player who = Player.Find(message.Split(' ')[0]);
            if (who == null) { Player.SendMessage(p, "Could not find player"); return; }
            if (p != null && who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot ban someone of the same rank"); return; }
            if (Server.devs.Contains(who.name.ToLower()))
            {
                Player.SendMessage(p, "You can't ban a MCForge Developer!");
                if (p != null)
                {
                    Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to tempban a MCForge Developer!");
                }
                else
                {
                    Player.GlobalMessage(Server.DefaultColor + "The Console attempted to tempban a MCForge Developer!");
                }
                return;
            }
            int minutes;
            try
            {
                minutes = int.Parse(message.Split(' ')[1]);
            } catch { Player.SendMessage(p, "Invalid minutes"); return; }
            if (minutes > 1440) { Player.SendMessage(p, "Cannot ban for more than a day"); return; }
            if (minutes < 1) { Player.SendMessage(p, "Cannot ban someone for less than a minute"); return; }

            Server.TempBan tBan;
            tBan.name = who.name;
            tBan.allowedJoin = DateTime.Now.AddMinutes(minutes);
            Server.tempBans.Add(tBan);
            who.Kick("Banned for " + minutes + " minutes!");
        }
开发者ID:hirsty,项目名称:MCForge-Vanilla,代码行数:35,代码来源:CmdTempBan.cs


示例9: Help

 public override void Help(Player p)
 {
     Player.SendMessage(p, "/save - Saves the level you are currently in");
     Player.SendMessage(p, "/save all - Saves all loaded levels.");
     Player.SendMessage(p, "/save <map> - Saves the specified map.");
     Player.SendMessage(p, "/save <map> <name> - Backups the map with a given restore name");
 }
开发者ID:AnthonyANI,项目名称:MCForge-MCLawl,代码行数:7,代码来源:CmdSave.cs


示例10: SelectPlayer

    void SelectPlayer(float parh, float parV)
    {
        if (Input.GetKey(KeyCode.Z) || parh > 0.4 && _advancedPlayer == null)
        {
            if (!_playerList[0].isAdvanced)
            {
                _selectedPlayer = (Player)_playerList[0];
                HideIndicators();
                _indicatorPlayer[0].SetActive(true);
            }
        }
        if (Input.GetKey(KeyCode.E) || parh < -0.4 && _advancedPlayer == null)
        {
            if (!_playerList[1].isAdvanced)
            {
                _selectedPlayer = (Player)_playerList[1];
                HideIndicators();
                _indicatorPlayer[1].SetActive(true);
            }
        }

        if (parh == 0 && parV == 0)
        {
            _selectedPlayer = null;
            HideIndicators();
        }
    }
开发者ID:Canonica,项目名称:TimounV2,代码行数:27,代码来源:PlayerManager.cs


示例11: Update

 // Update is called once per frame
 void Update()
 {
     Phealth = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     Health = Phealth.Health;
     if (GameObject.Find ("TD") != null)
     {
         FireRate = GameObject.Find ("TD").GetComponent<shoot_Bullet> ();
     }
     else
     {
         FireRate = GameObject.Find ("head").GetComponent<shoot_Bullet> ();
     }
     Reload = FireRate.fireRate;
     Hit = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     Hit_Bullet = Hit.hit_Bullet;
     if (GameObject.Find ("TD") != null)
     {
         shoot = GameObject.Find ("TD").GetComponent<shoot_Bullet> ();
     }
     else
     {
         shoot = GameObject.Find ("head").GetComponent<shoot_Bullet> ();
     }
     s_Count = shoot.s_Count;
     Hit_rate = (Hit_Bullet / s_Count) * 100;
     Level = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     level = Level.Level;
 }
开发者ID:JIIIIIND,项目名称:TanK,代码行数:29,代码来源:GUI_State.cs


示例12: testLandOn

        public void testLandOn()
        {
            Utility util = new Utility();

            //Create two players
            Player p1 = new Player("Bill");
            Player p2 = new Player("Fred", 1500);

            string msg;

            //test landon normally with no rent payable
            msg = util.landOn(ref p1);
            Console.WriteLine(msg);

            //set owner to p1
            util.setOwner(ref p1);

            //move p2 so that utility rent can be calculated
            p2.move();

            //p2 lands on util and should pay rent
            msg = util.landOn(ref p2);
            Console.WriteLine(msg);

            //check that correct rent  has been paid
            decimal balance = 1500 - (6 * p2.getLastMove());
            Assert.AreEqual(balance, p2.getBalance());
        }
开发者ID:lukesUbuntu,项目名称:c-sharp-monopoly-game-console-,代码行数:28,代码来源:_UtilityTest.cs


示例13: Use

 public void Use(Player p, string[] args)
 {
     if (args.Length == 0) { p.SendMessage("You have to specify a message!"); return; }
     string message = null;
     foreach (string s in args) { message += s + " "; }
     Player.UniversalChat(message);
 }
开发者ID:EricKilla,项目名称:MCForge-Vanilla-1,代码行数:7,代码来源:CmdSay.cs


示例14: Update

 public override void Update(Room room, Player player)
 {
     Vector2 offset = player.position - position;
     Vector2 range = Main.instance.Size();
     if (Math.Abs(offset.X) > range.X / 2f || Math.Abs(offset.Y) > range.Y / 2f)
     {
         shootTimer = 0;
     }
     else
     {
         shootTimer++;
         if (shootTimer >= maxShootTimer)
         {
             Vector2 direction = offset;
             if (direction != Vector2.Zero)
             {
                 direction.Normalize();
             }
             direction *= shootSpeed;
             PositionalBullet bullet = new PositionalBullet(position, direction, 10f, bulletTexture, bulletTime);
             room.bullets.Add(bullet);
             shootTimer = 0;
         }
     }
 }
开发者ID:bluemagic123,项目名称:Slip,代码行数:25,代码来源:Turret.cs


示例15: CheckCollision

 public bool CheckCollision(Player p)
 {
     if (p.State == Player.PlayerState.JUMP || p.State == Player.PlayerState.DYING)
             return false;
         return Mathf.Abs(p.x + p.hitBox.x - pos.x) < SPAWN_COLLISION_DIST &&
             Mathf.Abs(p.y + p.hitBox.y - pos.y) < SPAWN_COLLISION_DIST;
 }
开发者ID:maggardJosh,项目名称:SpiritGuard,代码行数:7,代码来源:SpawnPoint.cs


示例16: OnDestroy

    protected override void OnDestroy()
    {
        base.OnDestroy();

        mHeart = null;
        mPlayer = null;
    }
开发者ID:ddionisio,项目名称:GitGirl,代码行数:7,代码来源:SirRobert.cs


示例17: Initialize

 public void Initialize(Player player)
 {
     this.Player = player;
     playerTransform.gameObject.GetComponent<PlayerAnimatorChanger>().SetAnimator(player);
     this.playerTransform.position = startLocation.position;
     this.Enable(true);
 }
开发者ID:RicardoEPRodrigues,项目名称:LetsParty,代码行数:7,代码来源:PlayerInitializer.cs


示例18: Start

     void Start ()
    {
        player = transform.root.GetComponent<Player>();
        SetCursorState(CursorState.Default);

        resourceValues = new Dictionary<ResourceType, int>();
        resourceLimits = new Dictionary<ResourceType, int>();

        resourceValues.Add(ResourceType.Gold, 0);
        resourceLimits.Add(ResourceType.Gold, 0);
        resourceValues.Add(ResourceType.Nelther, 0);
        resourceLimits.Add(ResourceType.Nelther, 0);
        resourceValues.Add(ResourceType.Elynium, 0);
        resourceLimits.Add(ResourceType.Elynium, 0);
        resourceValues.Add(ResourceType.Population, 0);
        resourceLimits.Add(ResourceType.Population, 0);

        posBar = transform.FindChild("Frame1").FindChild("Frame").FindChild("BackGround").FindChild("Production").gameObject.transform.position;

        transform.FindChild("Frame1").FindChild("UnitNameProduct").GetComponent<Text>().text = "";
        transform.FindChild("Frame1").FindChild("HitText").GetComponent<Text>().text = "";
        transform.FindChild("Frame1").FindChild("Object").gameObject.SetActive(false);

        transform.FindChild("Frame1").FindChild("Frame").gameObject.SetActive(false);
        transform.FindChild("Frame1").FindChild("UnitNameProduct").gameObject.SetActive(false);
        for (int j = 1; j < 6; j++)
        {
            transform.FindChild("Frame1").FindChild("FrameUnit" + j.ToString()).gameObject.SetActive(false);
        }
    }
开发者ID:Phelisse,项目名称:Elynium,代码行数:30,代码来源:HUD.cs


示例19: StartNew

        public Board StartNew(Player whitePlayer, Player blackPlayer, string fenString = null)
        {
            this.CloseDialog();

            this.Width = 850;
            this.Height = 850;

            this.Clear();
            //this.Focus();
            this.Visible = true;

            if (fenString == null)
                this.Board = new Board(whitePlayer, blackPlayer);
            else
                this.Board = new Board(whitePlayer, blackPlayer, fenString);

            this.Board.SquareChanged += square => DrawSquare(square);
            this.Board.Check += (player) => { if (this.Board != null && this.Board.CurrentPlayer is HumanPlayer) MessageBox.Show("Check!"); };
            this.Board.Checkmate += (player) => { MessageBox.Show("Checkmate!"); this.Cursor = Cursors.Arrow; };
            this.Board.Stalemate += (reason) => { MessageBox.Show("Stalemate: " + reason.GetDescription()); this.Cursor = Cursors.Arrow; };

            whitePlayer.Turn += () => this.Invoke((Action)(() => this.Cursor = whitePlayer is HumanPlayer ? Cursors.Arrow : Cursors.WaitCursor));
            blackPlayer.Turn += () => this.Invoke((Action)(() => this.Cursor = blackPlayer is HumanPlayer ? Cursors.Arrow : Cursors.WaitCursor));

            foreach (var square in Enum.GetValues(typeof(Square)).Cast<Square>())
                DrawSquare(square);

            if (this.GameStarted != null)
                this.GameStarted(this.Board);

            return this.Board;
        }
开发者ID:hcesar,项目名称:Chess,代码行数:32,代码来源:BoardControl.cs


示例20: UseItem

        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            Log.Warn("Player " + player.Username + " should be banned for hacking!");

            var block = world.GetBlock(blockCoordinates);
            if (block is Tnt)
            {
                world.SetBlock(new Air() {Coordinates = block.Coordinates});
                new PrimedTnt(world)
                {
                    KnownPosition = new PlayerLocation(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z),
                    Fuse = (byte) (new Random().Next(0, 20) + 10)
                }.SpawnEntity();
            }
            else if (block.IsSolid)
            {
                var affectedBlock = world.GetBlock(GetNewCoordinatesFromFace(blockCoordinates, BlockFace.Up));
                if (affectedBlock.Id == 0)
                {
                    var fire = new Fire
                    {
                        Coordinates = affectedBlock.Coordinates
                    };
                    world.SetBlock(fire);
                }
            }
        }
开发者ID:newchild,项目名称:MiNET,代码行数:27,代码来源:ItemFlintAndSteel.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PlayerAction类代码示例发布时间:2022-05-24
下一篇:
C# PlaybackState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap