コード例 #1
0
        public Player(GameInstance game, math.Position position, UserInfo info) : base(game, position)
        {
            this.turn  = false;
            this.Info  = info;
            this.dirty = true;
            this.glyph = Program.UserIdToUsername(this.Info.UserId)[0];

            // check if this id is already in the accounts list
            string[] lines = File.ReadAllLines(Settings.PLAYERS_PATH);

            // for all lines, except the first (which is the header)
            for (int i = 1; i < lines.Length; i++)
            {
                string   line   = lines[i];
                string[] fields = line.Split(Settings.CSV_DELIMITER);

                ulong lineUserId = ulong.Parse(fields[0]);

                // if user was found
                if (lineUserId == this.Info.UserId)
                {
                    break;
                }
            }
        }
コード例 #2
0
 public Bullet(GameInstance game, math.Position position, Entity source, math.Direction direction) : base(game, position)
 {
     this.owner     = source;
     this.glyph     = 'O';
     this.direction = direction;
     if (!source.game.IsClear(source.pos.offset(direction)))
     {
         this.Remove();
     }
 }
コード例 #3
0
ファイル: Rock.cs プロジェクト: harrisonheld/Discord-Hex-Bot
 public Rock(GameInstance game, math.Position position) : base(game)
 {
     this.pos   = position;
     this.glyph = Settings.ROCK_GLYPHS[this.game.random.Next(Settings.ROCK_GLYPHS.Length)];
 }