Exemple #1
0
        public void Shot(Guid shotPlayerId, Guid reboundPlayerId = new Guid())
        {
            DbAttackShot playerShot = Shots.FirstOrDefault(p => p.PlayerId.Equals(shotPlayerId));

            if (playerShot == null)
            {
                Shots.Add(new DbAttackShot
                {
                    Id       = Guid.NewGuid(),
                    AttackId = DbAttack.Id,
                    PlayerId = shotPlayerId,
                    Count    = 1
                });
            }
            else
            {
                playerShot.Count++;
            }

            if (reboundPlayerId == Guid.Empty)
            {
                return;
            }

            IDbAttackRebound playerRebound = Rebounds.FirstOrDefault(p => p.PlayerId.Equals(reboundPlayerId));

            if (playerRebound == null)
            {
                Rebounds.Add(new DbAttackRebound
                {
                    Id       = Guid.NewGuid(),
                    AttackId = DbAttack.Id,
                    PlayerId = reboundPlayerId,
                    Count    = 1
                });
            }
            else
            {
                playerRebound.Count++;
            }
        }
 public void RemoveShot(DbAttackShot shot)
 {
     myDbConnection.Delete(shot);
 }
 public void AddShot(DbAttackShot shot)
 {
     myDbConnection.Insert(shot);
 }