Example #1
0
 public async void ScheduleMatchEnd()
 {
     await Task.Delay(Match.MatchLength);
     if (Math.Min(this.attackerLifeRequest, this.defenderLifeRequest) < 0)
     {
         MsgObjects.EndGame temp = new MsgObjects.EndGame("defender");
         this.SendMessage(null, temp.ToJSON());
     }
 }
Example #2
0
        public void LifeReduced(WebSocket ws)
        {
            if (ws == this.attacker.getSocket())
            {
                this.attackerLifeRequest++;
            }
            else
            {
                this.defenderLifeRequest++;
            }

            if (Math.Min(this.attackerLifeRequest, this.defenderLifeRequest) >= 3)
            {
                MsgObjects.EndGame temp = new MsgObjects.EndGame("attacker");
                this.SendMessage(null, temp.ToJSON());
            }
        }