Esempio n. 1
0
 public void LightMasterEventConstructorTest()
 {
     TwoServerWindow twoServer = null; // TODO: Initialize to an appropriate value
     float timeToEvent = 0F; // TODO: Initialize to an appropriate value
     LightMasterEvent target = new LightMasterEvent(twoServer, timeToEvent);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 2
0
 public void ExecuteTest()
 {
     TwoServerWindow twoServer = null; // TODO: Initialize to an appropriate value
     float timeToEvent = 0F; // TODO: Initialize to an appropriate value
     LightMasterEvent target = new LightMasterEvent(twoServer, timeToEvent); // TODO: Initialize to an appropriate value
     target.Execute();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Esempio n. 3
0
        /// <summary>
        /// Event for when a player turns on their light
        /// </summary>
        /// <param name="p">Player that turned on their light</param>
        public void PlayerLight( Player p )
        {
            if( LightsOn == 0 )
            {
                if( LightMaster == p.PlayerNumber)
                {
                    if (LastLight + 450000000 > DateTime.Now.Ticks)
                    {

                        _twoServer.SendToPlayer(p,"ANNOUNCE Too soon!");
                        return;
                    }
                    PlayerTurnedOnLight(p);
                    LightMasterEvent lm = new LightMasterEvent(_twoServer, 30f);
                    lm.Start();
                    _twoServer.TimedEventList.Add(lm);
                    LightsOn++;
                    LastLight = DateTime.Now.Ticks;
                }
                else
                {
                    PlayerFailedLight( p );
                }
            }
            else if (LightsOn == NumberPlayers - 1)
            {
                ResetLightMaster();
                PlayerFailedLight( p);
            }
            else
            {
                LightsOn++;
                PlayerTurnedOnLight( p);
            }
        }