コード例 #1
0
ファイル: ModelFactory.cs プロジェクト: lanedraex/clicker
 /// <summary>
 /// Returns a Player based on specified playerModel.
 /// </summary>
 /// <param name="playerModel"></param>
 /// <returns></returns>
 public Player Create(PlayerModel playerModel)
 {
     return new Player
     {
         Hero = Create(playerModel.Hero),
         Id = playerModel.PlayerId,
         Name = playerModel.Name,
         Score = playerModel.Score,
         UpdatedDate = DateTime.Now
     };
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: lanedraex/clicker
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            IsMouseVisible = true;
            mouse = Mouse.GetState();

            // (NOTE): Hero
            heroPos = new Vector2(100f, 100f);
            hero = new HeroModel
            {
                Attack = 1,
                Health = 20,
                HeroId = 1,
                ImageData = "healer",
                Magic = 10,
                Name = "Healer"
            };

            heroRect = new Rectangle(10, 100, 64, 64);
            heroScale = new Vector2(0.1f);

            // (NOTE): Monster
            monsterPos = new Vector2(150f, 100f);
            monster = new MonsterModel
            {
                Attack = 1,
                Health = 20,
                MonsterId = 1,
                ImageData = "monster",
                Name = "Genericus"
            };

            monsterRect = new Rectangle(10, 100, 100, 100);
            monsterScale = new Vector2(0.3f);

            // (NOTE): Player
            playerList = new List<PlayerModel>();
            player = new PlayerModel
            {
                Hero = hero,
                Name = "Zeqzor",
                PlayerId = 1,
                Score = 0
            };
            playerList.Add(player);

            // (NOTE): Match
            match = new MatchModel
            {
                Level = 1,
                MatchId = 1,
                Monster = monster,
                Players = playerList,
            };

            base.Initialize();
        }