void Start() { try { SetUpAnimator(); weps.SetUpWeapons(anim); Debug.Log(weps.WeaponIcon.name); cam = Camera.main.transform; anim = GetComponent <Animator>(); rigidBody = GetComponent <Rigidbody>(); audioSource = GetComponent <AudioSource>(); GameObject obj = GameObject.Find("GameplayCanvas");//.GetComponentInChildren<Right_Stick>(); r_stick = obj.GetComponentInChildren <Right_Stick>(); l_stick = obj.GetComponentInChildren <Left_Stick>(); powerUpIcon = obj.GetComponentInChildren <PowerUpsUI>().GetComponentInChildren <Image>(true); powerUpSlider = obj.GetComponentInChildren <PowerUpsUI>().GetComponentInChildren <Slider>(true); reloadUI = obj.GetComponentInChildren <ReloadUI>(); } catch { } StartCoroutine("FootSteps"); }
public async Task <bool> Login(LoginRequest credentials) { var response = await _client.PostAsync($"{baseUrl}/api/Account/login", RequestHelper.GetStringContentFromObject(credentials)); if (response.StatusCode == HttpStatusCode.OK) { LoggedInUser = JsonConvert.DeserializeObject <LoginResult>(response.Content.ReadAsStringAsync().Result); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LoggedInUser.AccessToken); var value = 1; //https://localhost:44331/api/Users/ UserId = Convert.ToInt32(value); ReloadUI?.Invoke(); return(true); } return(false); }
private string ReceivedServerMessage(Server s, JObject message) { if (message["Action"].ToString() == "UpdateTest") { var sentTest = (Test)message["Test"].ToObject(typeof(Test)); this.currentTest.State = sentTest.State; switch (currentTest.State) { case Test.TestState.OnHold: this.TestState.State = UserState.OnHold; break; case Test.TestState.Started: this.TestState.State = UserState.Testing; break; } SendStateUpdate(); ReloadUI?.Invoke(); return(null); } if (message["Action"].ToString() == "AddTime") { var time = (TimeSpan)message["TimeSpan"]; this.TestState.RemainingTime += time; SendStateUpdate(); ReloadUI?.Invoke(); return(null); } if (message["Action"].ToString() == "Sync") { this.TestState = message["UserState"].ToObject <UserTestState>(); ReloadUI?.Invoke(); } if (message["Action"].ToString() == "Pause") { this.TestState.State = UserTestState.UserState.OnHold; ReloadUI?.Invoke(); } if (message["Action"].ToString() == "Resume") { this.TestState.State = UserTestState.UserState.Testing; ReloadUI?.Invoke(); } if (message["Action"].ToString() == "Handover") { try { this.Handover().Wait(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Handover Failed"); } } return(null); }