// Update background in use and apply the changes to the play page. public void UpdateBackgroundInUse(BackgroundList.Background targetBackground) { backgroundInUseName = targetBackground.Name; foreach (Transform background in _backgroundImages.transform) { background.gameObject.GetComponent <SpriteRenderer>().sprite = targetBackground.ImageSprite; } }
// Check if the user owns a specific background. // Return true if the user owns it; Otherwise return false. public bool CheckBackgroundOwnership(BackgroundList.Background background) { return(backgroundNameToOwnership[(int)background.Name] == Ownership.Owned); }
private void SwitchToTargetBackground(BackgroundList.Background targetBackground) { GameDataController.GetGameData().UpdateBackgroundInUse(targetBackground); SetBackgroundUsageStatus(); }