private void RpcAcceptDemand(int demandID, string matterID, float timeLimit) { if (this.isClientOnly) { Matter targetMatter = Matter.GetByID(matterID); if (targetMatter != null) { this.AcceptDemand(new Demand(demandID, targetMatter, timeLimit)); } else { Debug.LogError($"Cannot accept nonexisting matter with id '{matterID}'."); } } }
public override void OnDeserialize(NetworkReader reader, bool initialState) { base.OnDeserialize(reader, initialState); if (initialState) { int amountOfDemands = reader.ReadInt32(); Demand demand; for (int i = 0; i < amountOfDemands; i++) { demand = new Demand(reader.ReadInt32(), Matter.GetByID(reader.ReadString()), reader.ReadSingle()); if (demand.HasTimeLimit) { demand.SetTimeLeft(reader.ReadSingle()); } this.AcceptDemand(demand); } } }