Beispiel #1
0
        public bool Handle(IEvent evt)
        {
            if (evt is GoalEvent)
            {
                _killReason = KillReason.PLAYER_GOAL;
                SoftEnd();
            }

            return(false);
        }
 public void ProcessKilled(ProcessRunner runner, KillReason reason)
 {
     lock (this)
     {
         TimeSpan offset     = runner.StartTime - DateTime.Now;
         string   reasonText = "";
         if (reason == KillReason.TimedOut)
         {
             reasonText = "Process timed out";
         }
         else if (reason == KillReason.Unknown)
         {
             reasonText = "Kill() was called";
         }
         _output.WriteLine("    Killing process: " + offset.ToString(_timeFormat) + ": " + reasonText);
     }
 }
Beispiel #3
0
        public void Kill(KillReason reason = KillReason.Unknown)
        {
            IProcessLogger[] loggers = null;
            Process          p       = null;

            lock (_lock)
            {
                if (_waitForExitTask.IsCompleted)
                {
                    return;
                }
                if (_killReason.HasValue)
                {
                    return;
                }
                _killReason = reason;
                if (!_p.HasExited)
                {
                    p = _p;
                }

                loggers = _loggers.ToArray();
                _cancelSource.Cancel();
            }

            if (p != null)
            {
                // its possible the process could exit just after we check so
                // we still have to handle the InvalidOperationException that
                // can be thrown.
                try
                {
                    p.Kill();
                }
                catch (InvalidOperationException) { }
            }

            foreach (IProcessLogger logger in loggers)
            {
                logger.ProcessKilled(this, reason);
            }
        }
Beispiel #4
0
 public void Kill(KillReason reason, int value)
 {
     Destroy(gameObject);
 }
Beispiel #5
0
 public void Kill(KillReason reason)
 {
     GameObject.Destroy(gameObject);
 }
Beispiel #6
0
 public void SetKillReason(KillReason killReason)
 {
     this.KillReason = killReason;
 }