private void AssignToWaterPark(String waterParkGuid, Pickupable pickupable) { GameObject waterParkGo = GuidHelper.RequireObjectFrom(waterParkGuid); WaterPark waterPark = waterParkGo.RequireComponent <WaterPark>(); waterPark.AddItem(pickupable); }
// The next two functions could potentially reside outside of this specific serializer. // They only happen to be in here because dropped items use this code path. private void AssignToWaterPark(GameObject gameObject, string waterParkGuid) { Pickupable pickupable = gameObject.RequireComponent <Pickupable>(); GameObject waterParkGo = GuidHelper.RequireObjectFrom(waterParkGuid); WaterPark waterPark = waterParkGo.RequireComponent <WaterPark>(); waterPark.AddItem(pickupable); }
// The next two functions could potentially reside outside of this specific serializer. // They only happen to be in here because dropped items use this code path. private void AssignToWaterPark(GameObject gameObject, NitroxId waterParkId) { Pickupable pickupable = gameObject.RequireComponent <Pickupable>(); GameObject waterParkGo = NitroxEntity.RequireObjectFrom(waterParkId); WaterPark waterPark = waterParkGo.RequireComponent <WaterPark>(); waterPark.AddItem(pickupable); }
private void AssignToWaterPark(String waterParkGuid, Pickupable pickupable) { Optional <GameObject> opWaterPark = GuidHelper.GetObjectFrom(waterParkGuid); if (opWaterPark.IsPresent()) { WaterPark waterPark = opWaterPark.Get().GetComponent <WaterPark>(); if (waterPark != null) { waterPark.AddItem(pickupable); } else { Console.WriteLine("Could not find water park component on that game object"); } } else { Console.WriteLine("Could not locate water park with guid: " + waterParkGuid); } }