Skip to content

Instantly share code, notes, and snippets.

View Enigo's full-sized avatar

Ruslan S. Enigo

View GitHub Profile
LevelsChecker - click to expand!
namespace GameData
{
    public class LevelsChecker
    {
        private readonly int _sideSize;
LevelsChecker - click to expand!
namespace GameData
{
    public class LevelsChecker
    {
        private readonly int _sideSize;
BruteForceLevelsChecker - click to expand!
class BruteForceLevelsChecker {

    private final int sideSize;

    BruteForceLevelsChecker(int sideSize) {
        this.sideSize = sideSize;
BruteForceLevelsGenerator - click to expand!
public class BruteForceLevelsGenerator {
    private static final int MIN_NODE_COUNT_INCLUDED = 4;
    private static final int MAX_NODE_COUNT_EXCLUDED = 7;
    private static final int SIDE_SIZE = 4;  // 16 --> max 12 min 10
    
    private static final int SIDE_WITHOUT_CORNERS_SIZE = SIDE_SIZE - 2;
LevelsGenerator - click to expand!
class LevelsGenerator {
    // MIN NODE = SIDE_SIZE * SIDE_SIZE * 0.75
    // MAX NODE = SIDE_SIZE * SIDE_SIZE * 0.625

    private static final int MIN_NODE_COUNT_INCLUDED = 4;
    private static final int MAX_NODE_COUNT_EXCLUDED = 7;
public class ChangeOrientationButton : MonoBehaviour
{
public void ChangeOrientation()
{
if (Screen.orientation == ScreenOrientation.Portrait)
{
Screen.orientation = ScreenOrientation.Landscape;
}
else
{
@Enigo
Enigo / 7.cs
Created February 6, 2021 20:32
public static class PlayerPrefsUtils
{
private const string Orientation = "Orientation";
public static bool IsPortrait()
{
return PlayerPrefs.GetInt(Orientation, 1) == 1;
}
public static bool HasOrientation()
@Enigo
Enigo / 8.cs
Created February 6, 2021 20:33
public void ChangeOrientation()
{
if (Screen.orientation == ScreenOrientation.Portrait)
{
Screen.orientation = ScreenOrientation.Landscape;
PlayerPrefsUtils.SavePortrait(false);
}
else
{
Screen.orientation = ScreenOrientation.Portrait;
@Enigo
Enigo / 9.cs
Created February 6, 2021 20:33
public class OrientationSetter : MonoBehaviour
{
private void Awake()
{
SetupInitialOrientation();
}
private static void SetupInitialOrientation()
{
if (PlayerPrefsUtils.HasOrientation())
@Enigo
Enigo / 10.cs
Last active February 23, 2021 22:43
public class OrientationSetter : MonoBehaviour
{
private void Awake()
{
StartCoroutine(SetupInitialOrientation());
}
private static IEnumerator SetupInitialOrientation()
{
if (PlayerPrefsUtils.HasOrientation())