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


C# Player类代码示例

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


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


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