void CreateAnEmployee() { EmployeeManifestation = GameObject.CreatePrimitive(PrimitiveType.Cube); //adds a Cube object to the scene, which will act as an anchor for an Employee, and the EmployeeListener that will reference it EmployeeListener = EmployeeManifestation.AddComponent <EmployeeListener>(); //Add an EmployeeListener object to the cube we created. EmployeeListener is "initialized" with the values in EmployeeListener.cs "Start()" method. Employee = EmployeeManifestation.AddComponent <Employee>(); //Add an Employee object to the cube we created. Employee is "initialized" with the values in Employee.cs "Start()" method. Employee.Randomize(Title.Janitor); //Randomize the Employee, using Randomize(Title) method in Employee.cs EmployeeListener.Employee = Employee; //Add a reference to the Randomized Employee to the EmployeeListener }
public async Task SendMessage() { if (!_cache.TryGetValue("employeeCache", out string response)) { EmployeeListener employeeList = new EmployeeListener(_hubContext, _cache, _configuration); employeeList.ListenForAlarmNotifications(); string jsonEmployeeAlarm = employeeList.GetAlarmList(); _cache.Set("employeeCache", jsonEmployeeAlarm); await Clients.All.SendAsync("ReceiveMessage", _cache.Get("employeeCache").ToString()); } else { await Clients.All.SendAsync("ReceiveMessage", _cache.Get("employeeCache").ToString()); } }