A classic puzzle game for mobile devices. Features high replay value through challenging game-play as well as the ability to post and compare high scores to a public leaderboard.
- Developed in Unity and programmed in C#.
- Google Play Games (Android) / Game Center (iOS) for leaderboards.
- Sprite animations with optimized sprite sheets for minimal draw calls.
- AdMob and Unity Ads for in-game ads.
- Published on both Apple's App Store and Google Play with many downloads on each platform.
/**
* NWindow.cs
* Core functionality for all UI windows, including logic to show, hide and ensure only one window
* can be open at a time.
* NicholusHuber@gmail.com
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
[RequireComponent (typeof (TweenAlpha))]
[RequireComponent (typeof (TweenScale))]
public class NWindow : MonoBehaviour
{
public static List<NWindow> AllNWindows;
[UsedImplicitly]
private void Awake()
{
if(AllNWindows == null) AllNWindows = new List<NWindow>();
AllNWindows.Add(this);
}
/// <summary>
/// Show the options window
/// </summary>
public void ShowWindow()
{
if (Time.timeSinceLevelLoad < 2f) return; // prevents unintended execution on load.
Helpers.Task(GetComponent<UISprite>().alpha > 0.95f ? Cancel() : Show(), this);
}
private IEnumerator Show()
{
CloseAllWindows(this);
Block.DisableInput = true;
var tweenAlpha = GetComponent<TweenAlpha>();
var tweenScale = GetComponent<TweenScale>();
if (tweenAlpha.direction == AnimationOrTween.Direction.Forward) tweenAlpha.ResetToBeginning();
if (tweenScale.direction == AnimationOrTween.Direction.Forward) tweenScale.ResetToBeginning();
tweenAlpha.PlayForward();
tweenScale.PlayForward();
yield return new WaitForSeconds(tweenAlpha.duration);
}
/// <summary>
/// Hide the options window.
/// </summary>
public void CancelWindow()
{
if (Time.timeSinceLevelLoad < 2f) return; // prevents unintended execution on load.
StartCoroutine(Cancel());
}
private IEnumerator Cancel()
{
Block.DisableInput = false;
var tweenAlpha = GetComponent<TweenAlpha>();
var tweenScale = GetComponent<TweenScale>();
tweenAlpha.PlayReverse();
tweenScale.PlayReverse();
yield return new WaitForSeconds(tweenAlpha.duration);
}
/// <summary>
/// Closes all windows, except the one that called this function.
/// </summary>
/// <param name="callingNWin">The NWindow instance that is calling this function.</param>
public static void CloseAllWindows(NWindow callingNWin)
{
foreach (var win in AllNWindows)
{
if(win != callingNWin)
win.CancelWindow();
}
}
}
/**
* Audio.cs
* Functionality for audio throughout nBlocks.
* NicholusHuber@gmail.com
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Audio : MonoBehaviour
{
public static Audio Instance;
[SerializeField] private List<AudioClip> _audioClips;
public AudioSource SoundSource;
public AudioSource MusicSource;
private void Awake()
{
Instance = this;
}
public void PlaySound(int clipPos, float vol = 1)
{
if(SoundSource == null) return;
if (PlayerPrefs.HasKey(Intro.SoundKey))
{
if (!Helpers.GetBool(Intro.SoundKey)) return;
}
SoundSource.PlayOneShot(_audioClips[clipPos], vol);
}
public void PlayMusic()
{
if (MusicSource == null) return;
if (PlayerPrefs.HasKey(Intro.MusicKey))
{
if (!Helpers.GetBool(Intro.MusicKey)) return;
}
MusicSource.Play();
}
public void StopMusic()
{
if(MusicSource != null) MusicSource.Stop();
}
public void FadeMusic()
{
Helpers.Task(Helpers.LerpFloat(MusicSource.volume, 0, s => MusicSource.volume = s), this);
}
}