-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/UnityLV/Lara-Story-
- Loading branch information
Showing
13 changed files
with
1,393 additions
and
15 deletions.
There are no files selected for viewing
616 changes: 606 additions & 10 deletions
616
Assets/Plugins/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using UnityEngine; | ||
|
||
[System.Serializable] | ||
public class BackgroundConfig | ||
{ | ||
[field: SerializeField] public Sprite Sprite { get; private set; } | ||
[field: SerializeField] public int StartLevel { get; private set; } | ||
[field: SerializeField] public int EndLevel { get; private set; } | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class BackgroundSetter : MonoBehaviour | ||
{ | ||
[SerializeField] private Image _bagroundImage; | ||
[SerializeField] private BackgroundConfig[] _configs; | ||
|
||
private void Start() | ||
{ | ||
SetBaground(); | ||
} | ||
|
||
private void SetBaground() | ||
{ | ||
_bagroundImage.sprite = GetBackground(); | ||
} | ||
|
||
private Sprite GetBackground() | ||
{ | ||
foreach (var config in _configs) | ||
{ | ||
if (IsSutableConfig(config)) | ||
{ | ||
return config.Sprite; | ||
} | ||
} | ||
|
||
return GetHighestLevelBackground(); | ||
} | ||
|
||
private bool IsSutableConfig(BackgroundConfig config) | ||
{ | ||
return config.StartLevel <= LevelSelector.SelectedLevel && | ||
config.EndLevel >= LevelSelector.SelectedLevel; | ||
} | ||
|
||
private Sprite GetHighestLevelBackground() | ||
{ | ||
return _configs.OrderByDescending(c => c.EndLevel).Select(c => c.Sprite).First(); ; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.