// ================================================================================================================ // CONSTRUCTOR ---------------------------------------------------------------------------------------------------- public GazeWatcher(Camera camera) { _camera = camera; _looper = new GameLooper(); _looper.onUpdate += onUpdate; }
// Use this for initialization void Start() { Instance = this; controlFrameRemain = controlframeStep; mt = new LogicGameObject(Target.gameObject, new SafeV3()); TestServer.Instance.OpenServer(); lastCmd = new Cmd(); }
// ================================================================================================================ // EXTENDED INTERFACE --------------------------------------------------------------------------------------------- void Awake() { DontDestroyOnLoad(gameObject); instance = this; _looper = new GameLooper(); _sceneManager = new SceneManager(); }
void Awake() { if (instant != null) { DestroyImmediate(gameObject); return; } instant = this; DontDestroyOnLoad(this); }
static void Main(string[] args) { var id = int.Parse(w.RL("请输入大于 100 的 Service ID")); var h = new Handler(id); Console.CursorVisible = false; new ContactCenterCallback(h); // 连接至 ContactCenter 并准备好回调实例 BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(h.SendMessage); bw.RunWorkerAsync(); var gameLooper = new GameLooper(h); // 创建游戏循环并运行 gameLooper.IsSpeedLimitMode = true; //限速循环 gameLooper.LoopDurationLimit = 1000; //每次循环耗时1秒 gameLooper.Loop(); }
// ================================================================================================================ // INTERNAL INTERFACE --------------------------------------------------------------------------------------------- private void onUpdate(GameLooper gameLooper) { // Do a raycast into the world based on camera position and orientation if (_camera == null) { return; } _position = _camera.transform.position; _direction = _camera.transform.forward; bool didHit = Physics.Raycast(_position, _direction, out _lastHit); if ((!didHit || _lastHit.transform.gameObject != _hitObject) && _isHitting) { // Ended a hit if (onObjectHitEnd != null) { onObjectHitEnd(this); } _isHitting = false; _hitPosition = Vector3.zero; _hitDirection = Vector3.zero; _hitObject = null; } if (didHit) { // It is hitting _hitPosition = _lastHit.point; _hitDirection = _lastHit.normal; if (!_isHitting) { // Started a new hit _isHitting = true; _hitObject = _lastHit.transform.gameObject; if (onObjectHitStart != null) { onObjectHitStart(this); } } if (onObjectHitMove != null) { onObjectHitMove(this); } } }
static void Main(string[] args) { var h = new Handler(150); //大厅暂为ID为150 Console.CursorVisible = false; new ContactCenterCallback(h); // 连接至 ContactCenter 并准备好回调实例 BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(h.SendMessage); bw.RunWorkerAsync(); var gameLooper = new GameLooper(h); // 创建游戏循环并运行 gameLooper.IsSpeedLimitMode = true; //限速循环 gameLooper.LoopDurationLimit = 1000; //每次循环耗时1秒 gameLooper.Loop(); }
/* * void FixedUpdate() { * if (_gameLooper != null) _gameLooper.dispatchFixedUpdate(); * } * * void LateUpdate() { * if (_gameLooper != null) _gameLooper.dispatchLateUpdate(); * } */ // ================================================================================================================ // PUBLIC INTERFACE ----------------------------------------------------------------------------------------------- public void setGameLooper(GameLooper gameLooper) { _gameLooper = gameLooper; }