private void OnOtherPlayerCompanyWorkerAbilityChangedRPC(int photonPlayerID, int workerID, int updatedAbility, float updatedAbilityValue) { SharedWorker updatedWorker = OtherPlayersWorkers.First(x => x.Key.ID == photonPlayerID).Value.First(x => x.ID == workerID); ProjectTechnology updatedAbilityEnum = (ProjectTechnology)updatedAbility; updatedWorker.UpdateAbility(updatedAbilityEnum, updatedAbilityValue); }
private void OnControlledCompanyWorkerAddedRPC(SharedWorker addedWorker, int photonPlayerID) { KeyValuePair <PhotonPlayer, List <SharedWorker> > workerPair = OtherPlayersWorkers.First(x => x.Key.ID == photonPlayerID); List <SharedWorker> workers = workerPair.Value; workers.Add(addedWorker); OtherPlayerWorkerAdded?.Invoke(addedWorker, workerPair.Key); #if DEVELOPMENT_BUILD || UNITY_EDITOR string debugInfo = string.Format("[{3}] Received worker update from player {0} (ID: {1}).\n" + "Worker added (ID: {2}). Local workers collection synchronized", workerPair.Key.NickName, workerPair.Key.ID, addedWorker.ID, this.GetType().Name); Debug.Log(debugInfo); #endif }
private void OnOtherPlayerCompanyWorkerAttirbuteChangedRPC(int photonPlayerID, int workerID, object attributeValue, int changedAttirbute) { WorkerAttribute attribute = (WorkerAttribute)changedAttirbute; SharedWorker updatedWorker = OtherPlayersWorkers.First(x => x.Key.ID == photonPlayerID).Value.First(x => x.ID == workerID); switch (attribute) { case WorkerAttribute.Salary: int newSalary = (int)attributeValue; updatedWorker.Salary = newSalary; break; case WorkerAttribute.ExpierienceTime: int newExpierienceTime = (int)attributeValue; updatedWorker.ExperienceTime = newExpierienceTime; break; default: break; } }
private void OnOtherPlayerControlledCompanyMinimalBalanceReachedRPC(int photonPlayerID) { KeyValuePair <PhotonPlayer, List <SharedWorker> > workerPair = OtherPlayersWorkers.First(x => x.Key.ID == photonPlayerID); this.OtherPlayerCompanyMinimalBalanceReached?.Invoke(workerPair.Key); }