Exemplo n.º 1
0
        /// <summary>
        /// To be called when a user performs an illegal action on this computer.
        /// </summary>
        public void PerformIllegalAction()
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            if (this != World.World.GetInstance().Player.PlayerComp)
            {
                ActiveTracer.GetInstance().StartTrace(TraceTime); // TODO: base tracetime on computer difficulty or something
            }
#pragma warning restore CS4014                                    // Because this call is not awaited, execution of the current method continues before the call is completed
            OnIllegalAction?.Invoke(this, new IllegalActionEventArgs(World.World.GetInstance().CurrentGameTime));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Disconnect the player from this computer
 /// </summary>
 public void Disconnect(bool forced = false)
 {
     World.World.GetInstance().Player.ConnectedComp = World.World.GetInstance().Player.PlayerComp;
     IsPlayerConnected = false;
     if (ActiveTracer.GetInstance().IsActive)
     {
         ActiveTracer.GetInstance().StopTrace();
     }
     OnDisconnected?.Invoke(this, new DisconnectedEventArgs(World.World.GetInstance().CurrentGameTime));
     if (forced)
     {
         Game.Terminal.WriteLine("Connection closed by remote host");
         MusicManager.GetInstance().ChangeSong("gameBgm", 0.5f);
     }
 }
Exemplo n.º 3
0
 public override void Update(GameTime gameTime)
 {
     _text = $"Trace: {ActiveTracer.GetInstance().GetTracePercentage()}";
     base.Update(gameTime);
 }
Exemplo n.º 4
0
 public override void Initialize()
 {
     base.Initialize();
     _font = FontManager.GetFont("FontM");
     _text = $"Trace: {ActiveTracer.GetInstance().GetTracePercentage()}";
 }