private void Awake() { if (TargetManager.Instance.PlottingTestMode) { return; } _appStateBroker = AppStateBroker.Instance; _testElements = TestElementsParent.GetComponent <CanvasGroup>(); var everyUpdate = Observable.EveryUpdate(); //debug binding everyUpdate .Select(_ => GameManager.TargetObject_External) .DistinctUntilChanged() .Subscribe(_ => Verbose = (GameManager.TargetObject_External & TargetObject.InputModule) == TargetObject.InputModule) .AddTo(gameObject); //snapbutton binding everyUpdate .Where(_ => Input.GetKeyDown(KeyCode.Alpha0)) .Select(_ => new Unit()) .Subscribe(_ => _appStateBroker.SnapButonObservable.OnNext(_)) .AddTo(gameObject); FadeManager.DisableCanvasGroup(_testElements, true); }
private void Awake() { gameObject.SetActive(!bool.Parse(Config.Read(CONFIG_KEYS.audiodisable))); _appStateBroker = AppStateBroker.Instance; if (DEVELOPER_MODE) { AudioSourceOutputDevice[] channels = transform.GetComponentsInChildren <AudioSourceOutputDevice>(); foreach (AudioSourceOutputDevice c in channels) { c.enabled = false; } } SFX_Volume = float.Parse(Config.Read(CONFIG_KEYS.lanevolume)); Ambient_Volume = int.Parse(Config.Read(CONFIG_KEYS.ambientvolume)); refVolumeOffset = float.Parse(Config.Read(CONFIG_KEYS.refvolumeoffset)); CrowdVoluemOffset = float.Parse(Config.Read(CONFIG_KEYS.crowdvolumeoffset)); var message_vol = new SharpOSC.OscMessage("/maxVol", Ambient_Volume); _UdpSender.Send(message_vol); }
void Start() { _appStateBroker = AppStateBroker.Instance; _server = ORTCPMultiServer.Instance; _tcpMessageRecieved = Observable .FromEvent <ORTCPMultiServer.TCPServerMessageRecivedEvent, ORTCPEventParams> ( h => p => h(p), h => ORTCPMultiServer.Instance.OnTCPMessageRecived += h, h => ORTCPMultiServer.Instance.OnTCPMessageRecived -= h ); _tcpMessageRecieved .Subscribe(OnMessageRecived) .AddTo(gameObject); _appStateBroker .ComOutGoingStream .Subscribe(msg => { Debug.Log(msg); _server.SendAllClientsMessage(msg); GameManager.StatusMsgBackup = msg; }) .AddTo(gameObject); }
private void Awake() { MaxDistance = float.Parse(Config.Read(CONFIG_KEYS.targetthreshold)); _appStateBroker = AppStateBroker.Instance; _inputModule = InputModule.Instance; _plot_Internal = this.GetComponent <RectTransform>(); }
private void Awake() { _appStateBroker = AppStateBroker.Instance; //debug binding Observable.EveryUpdate() .Select(_ => GameManager.TargetObject_External) .DistinctUntilChanged() .Subscribe(_ => Verbose = (GameManager.TargetObject_External & TargetObject.Plyaer) == TargetObject.Plyaer) .AddTo(gameObject); }
private void Awake() { _animator = transform.GetComponent <Animator>(); _canvas = transform.GetComponent <CanvasGroup>(); _appStateBroker = AppStateBroker.Instance; _teamManager = TeamManager.Instance; _timWindow = BindTimeWindow(Lane); _inputModule = InputModule.Instance; OnClientAdded(Initialize).AddTo(gameObject); Off(); _playerData = BindPlayerData(Lane); OnTimeWindowClosed().AddTo(gameObject); }
private void Awake() { _appStateBroker = AppStateBroker.Instance; var len = GameManager.Instance.Open4thLane ? 3 : 2; Observable .EveryUpdate() .Where(_ => PlottingTestMode && Input.GetKeyDown(KeyCode.Space)) .Subscribe(x => { LaneConfigSwich.Value++; if (LaneConfigSwich.Value > len) { LaneConfigSwich.Value = 0; } }) .AddTo(gameObject); }
private void Awake() { _appStateBroker = AppStateBroker.Instance; _appStateBroker.HikeStream.Subscribe(_ => Hike()).AddTo(gameObject); _inputModule = InputModule.Instance; var _PLCAddres = GameManager.DevMode_External? PLCAddress : Config.Read(CONFIG_KEYS.plcip).ToString(); plc = new Plc(cpu: CpuType.S71200, ip: _PLCAddres, rack: 0, slot: 1); ErrorCode errCode = plc.Open(); if (Verbose) { Debug.LogFormat("[{0}] initial status [{2}] => {1}", name, errCode, _PLCAddres); } var _DistanceFeet = GameManager.DevMode_External? DistanceFeet : float.Parse(Config.Read(CONFIG_KEYS.distance)); ErrorCode feet = PLCdata.SetDistance(plc, _DistanceFeet); if (Verbose) { Debug.LogFormat("[{0}] Setting feet to {2} => {1} feet", name, feet, _DistanceFeet); } ErrorCode duration = PLCdata.SetTTT(plc, TTTDuration); if (Verbose) { Debug.LogFormat("[{0}] Setting TTT to {2} => {1} secconds", name, duration, TTTDuration); } plc.Close(); Debug.Log("////////////////////////////////////"); Debug.LogFormat("[{0}] initial status [{2}] => {1}", name, errCode, _PLCAddres); Debug.Log("////////////////////////////////////"); //debug binding Observable.EveryUpdate() .Select(_ => GameManager.TargetObject_External) .DistinctUntilChanged() .Subscribe(_ => Verbose = (GameManager.TargetObject_External & TargetObject.PLCModule) == TargetObject.PLCModule) .AddTo(gameObject); }
private void Start() { _appStateBroker = AppStateBroker.Instance; Teams.ForEach(team => { var key = Enum.Parse(typeof(CONFIG_KEYS), team.team.ToString().ToLower()); var stats = Config.Read((CONFIG_KEYS)key).Split(','); var qbName = stats[0]; var percentage = stats[1]; team.playerName = qbName.Replace("_", " "); team.completionPercentage = percentage; }); _appStateBroker .ClientsList .ObserveAdd() .Subscribe(x => { try { var client = x.Value; SelectTeam(client.ClientId, client.Lane, client.Team); } catch (Exception e) { Debug.Log(e); throw; } }).AddTo(gameObject); _appStateBroker .CurrentRound .Where(round => round == Rounds.Idle) .Subscribe(x => PlayerSequences.Clear()) .AddTo(gameObject); }
private void Awake() { _appBroker = AppStateBroker.Instance; _qbPlay = QBPlay.Instance; }
private void Awake() { _appBroker = AppStateBroker.Instance; _QbIdle = QBIdle.Instance; }
private void Awake() { _appStateBroker = AppStateBroker.Instance; AutoTest = AutoTest_External; #if !UNITY_EDITOR DevMode = false; #endif //Debug msg binding Observable .EveryUpdate() .Select(_ => TargetLane) .DistinctUntilChanged() .Subscribe(_ => { TargetLane_External = _; }).AddTo(gameObject); Observable .EveryUpdate() .Select(_ => TargetObject) .DistinctUntilChanged() .Subscribe(_ => { TargetObject_External = _; }).AddTo(gameObject); //to reset ResetApp .Where(b => b) .Take(1) .Subscribe(x => { ResetApp.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(SceneManager.GetActiveScene().name)) .AddTo(gameObject); }) .AddTo(gameObject); //to clibration CalibrationMode .Where(b => b) .Take(1) .Subscribe(x => { CalibrationMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(Open4thLane?"MainScene_4Lane_Cal":"MainScene_3Lane_Cal")) .AddTo(gameObject); }) .AddTo(gameObject); //to main game GameMode .Where(b => b) .Take(1) .Subscribe(x => { GameMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => { SceneManager.LoadScene(Open4thLane ? "MainScene_4Lane" : "MainScene_3Lane"); }) .AddTo(gameObject); }) .AddTo(gameObject); //auto test if (AutoTest) { DebugOutputObjects.SetActive(true); ManualTeamSelectAllowed = ManualTeamSelectAllowedExternal = false; Observable.EveryUpdate().Select(_ => TestCount).Subscribe(x => { DubugOutput.text = x.ToString(); ThrowAllowed.gameObject.SetActive(TestCount % 2 != 0); }).AddTo(gameObject); _appStateBroker .CurrentRound .Subscribe(round => { switch (round) { case Rounds.Idle: Observable.Timer(TimeSpan.FromSeconds(2f)) .Take(1) .Subscribe(_ => { var len = Open4thLane ? 4 : 3; for (int i = 0; i < len; i++) { var client = new ORTCPEventParams(); var team = AutoTestIndexProvider.GetTeamIndex(); client.message = "{\"state\":10,\"station_id\":" + i + ",\"team\":" + team + "}"; _appStateBroker.ComReceivingStream.OnNext(client); } DelayedSanp(); }).AddTo(gameObject); break; case Rounds.R1: case Rounds.R2: case Rounds.R3: DelayedSanp(); break; case Rounds.Finish: DelayedSanp(); TestCount++; Debug.LogFormat("[{0}] Testing Count : {1}", name, TestCount); break; } }) .AddTo(gameObject); } else { DebugOutputObjects.SetActive(false); } }