Initial commit

This commit is contained in:
Ardella Malinda Sarastri
2025-07-10 17:06:42 +07:00
commit 72b8b42a0b
8149 changed files with 4223394 additions and 0 deletions

View File

@ -0,0 +1,113 @@
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class AnchorGameObject : MonoBehaviour
{
public enum AnchorType
{
BottomLeft,
BottomCenter,
BottomRight,
MiddleLeft,
MiddleCenter,
MiddleRight,
TopLeft,
TopCenter,
TopRight,
};
public bool executeInUpdate;
public AnchorType anchorType;
public Vector3 anchorOffset;
IEnumerator updateAnchorRoutine; //Coroutine handle so we don't start it if it's already running
// Use this for initialization
void Start()
{
updateAnchorRoutine = UpdateAnchorAsync();
StartCoroutine(updateAnchorRoutine);
}
/// <summary>
/// Coroutine to update the anchor only once CameraFit.Instance is not null.
/// </summary>
IEnumerator UpdateAnchorAsync()
{
uint cameraWaitCycles = 0;
while (CameraViewportHandler.Instance == null)
{
++cameraWaitCycles;
yield return new WaitForEndOfFrame();
}
if (cameraWaitCycles > 0)
{
print(string.Format("CameraAnchor found CameraFit instance after waiting {0} frame(s). " +
"You might want to check that CameraFit has an earlie execution order.", cameraWaitCycles));
}
UpdateAnchor();
updateAnchorRoutine = null;
}
void UpdateAnchor()
{
switch (anchorType)
{
case AnchorType.BottomLeft:
SetAnchor(CameraViewportHandler.Instance.BottomLeft);
break;
case AnchorType.BottomCenter:
SetAnchor(CameraViewportHandler.Instance.BottomCenter);
break;
case AnchorType.BottomRight:
SetAnchor(CameraViewportHandler.Instance.BottomRight);
break;
case AnchorType.MiddleLeft:
SetAnchor(CameraViewportHandler.Instance.MiddleLeft);
break;
case AnchorType.MiddleCenter:
SetAnchor(CameraViewportHandler.Instance.MiddleCenter);
break;
case AnchorType.MiddleRight:
SetAnchor(CameraViewportHandler.Instance.MiddleRight);
break;
case AnchorType.TopLeft:
SetAnchor(CameraViewportHandler.Instance.TopLeft);
break;
case AnchorType.TopCenter:
SetAnchor(CameraViewportHandler.Instance.TopCenter);
break;
case AnchorType.TopRight:
SetAnchor(CameraViewportHandler.Instance.TopRight);
break;
}
}
void SetAnchor(Vector3 anchor)
{
Vector3 newPos = anchor + anchorOffset;
if (!transform.position.Equals(newPos))
{
transform.position = newPos;
}
}
#if UNITY_EDITOR
// Update is called once per frame
void Update()
{
if (updateAnchorRoutine == null && executeInUpdate)
{
updateAnchorRoutine = UpdateAnchorAsync();
StartCoroutine(updateAnchorRoutine);
}
}
#endif
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e3284f2b426f72418fda875b016dd5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9032b0a88f0f44e45adb1fc6ef37bbd3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : MonoBehaviour
{
public static AudioManager Instance;
public Sound[] musicSounds, sfxSounds;
public AudioSource musicSource, sfxSource;
private Dictionary<string, Sound> musicDictionary = new Dictionary<string, Sound>();
private Dictionary<string, Sound> sfxDictionary = new Dictionary<string, Sound>();
void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
Setup();
}
else
{
if (Instance != this)
{
Destroy(gameObject);
}
}
}
private void Setup()
{
for (int i = 0; i < musicSounds.Length; i++)
{
musicDictionary[musicSounds[i].name] = musicSounds[i];
}
for (int i = 0; i < sfxSounds.Length; i++)
{
sfxDictionary[sfxSounds[i].name] = sfxSounds[i];
}
}
public void StopMusic()
{
musicSource.Stop();
}
public void PlayMusic(SoundName name)
{
Sound s = Array.Find(musicSounds, sound => sound.soundName == name);
if (s != null)
{
musicSource.clip = s.clip;
musicSource.Play();
}
}
public void PlayMusic(string name)
{
Sound s = musicDictionary[name];
if (s != null)
{
musicSource.clip = s.clip;
musicSource.Play();
}
}
public void PlaySfx(string name)
{
Sound s = sfxDictionary[name];
if (s != null)
{
sfxSource.PlayOneShot(s.clip);
}
}
public void PlaySfx(AudioClip clip)
{
sfxSource.PlayOneShot(clip);
}
public void PlaySfx(SoundName name)
{
Sound s = Array.Find(sfxSounds, sound => sound.soundName == name);
if (s != null)
{
sfxSource.PlayOneShot(s.clip);
}
}
public void PlaySfx(Sound sound)
{
if (sound != null)
{
sfxSource.PlayOneShot(sound.clip);
}
}
public void PlaySfx(Sound[] randomSound)
{
if (randomSound != null)
{
sfxSource.PlayOneShot(randomSound[UnityEngine.Random.Range(0, randomSound.Length)].clip);
}
}
public void PlaySfx(SoundName[] randomName)
{
SoundName name = randomName[UnityEngine.Random.Range(0, randomName.Length)];
Sound s = Array.Find(sfxSounds, sound => sound.soundName == name);
if (s != null)
{
sfxSource.PlayOneShot(s.clip);
}
}
public void SetSfxVolume(float volume)
{
sfxSource.volume = volume;
}
public void SetMusicVolume(float volume)
{
musicSource.volume = volume;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f5ac05904ff5ab4882b8026e7f21813
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
using UnityEngine;
[System.Serializable]
public class Sound
{
public string name;
public SoundName soundName;
public AudioClip clip;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 273e91268ea03254f9cde0aa8362ab44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
using UnityEngine;
[System.Serializable]
public class SoundList
{
[SerializeField] private Sound[] soundList;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b0ad2eabaf4aefc409fddc2622504ce3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,6 @@
public enum SoundName
{
GameMusic, MainMenuMusic
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 687137de75e342b4792ac6fdb52a4321
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,193 @@
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class CameraViewportHandler : MonoBehaviour
{
public enum Constraint { Landscape, Portrait }
#region FIELDS
public Color wireColor = Color.white;
public float UnitsSize = 1; // size of your scene in unity units
public Constraint constraint = Constraint.Portrait;
public static CameraViewportHandler Instance;
public new Camera camera;
public bool executeInUpdate;
private float _width;
private float _height;
//*** bottom screen
private Vector3 _bl;
private Vector3 _bc;
private Vector3 _br;
//*** middle screen
private Vector3 _ml;
private Vector3 _mc;
private Vector3 _mr;
//*** top screen
private Vector3 _tl;
private Vector3 _tc;
private Vector3 _tr;
#endregion
#region PROPERTIES
public float Width
{
get
{
return _width;
}
}
public float Height
{
get
{
return _height;
}
}
// helper points:
public Vector3 BottomLeft
{
get
{
return _bl;
}
}
public Vector3 BottomCenter
{
get
{
return _bc;
}
}
public Vector3 BottomRight
{
get
{
return _br;
}
}
public Vector3 MiddleLeft
{
get
{
return _ml;
}
}
public Vector3 MiddleCenter
{
get
{
return _mc;
}
}
public Vector3 MiddleRight
{
get
{
return _mr;
}
}
public Vector3 TopLeft
{
get
{
return _tl;
}
}
public Vector3 TopCenter
{
get
{
return _tc;
}
}
public Vector3 TopRight
{
get
{
return _tr;
}
}
#endregion
#region METHODS
private void Awake()
{
camera = GetComponent<Camera>();
Instance = this;
ComputeResolution();
}
private void ComputeResolution()
{
float leftX, rightX, topY, bottomY;
if (constraint == Constraint.Landscape)
{
camera.orthographicSize = 1f / camera.aspect * UnitsSize / 2f;
}
else
{
camera.orthographicSize = UnitsSize / 2f;
}
_height = 2f * camera.orthographicSize;
_width = _height * camera.aspect;
float cameraX, cameraY;
cameraX = camera.transform.position.x;
cameraY = camera.transform.position.y;
leftX = cameraX - _width / 2;
rightX = cameraX + _width / 2;
topY = cameraY + _height / 2;
bottomY = cameraY - _height / 2;
//*** bottom
_bl = new Vector3(leftX, bottomY, 0);
_bc = new Vector3(cameraX, bottomY, 0);
_br = new Vector3(rightX, bottomY, 0);
//*** middle
_ml = new Vector3(leftX, cameraY, 0);
_mc = new Vector3(cameraX, cameraY, 0);
_mr = new Vector3(rightX, cameraY, 0);
//*** top
_tl = new Vector3(leftX, topY, 0);
_tc = new Vector3(cameraX, topY, 0);
_tr = new Vector3(rightX, topY, 0);
}
private void Update()
{
#if UNITY_EDITOR
if (executeInUpdate)
ComputeResolution();
#endif
}
void OnDrawGizmos()
{
Gizmos.color = wireColor;
Matrix4x4 temp = Gizmos.matrix;
Gizmos.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
if (camera.orthographic)
{
float spread = camera.farClipPlane - camera.nearClipPlane;
float center = (camera.farClipPlane + camera.nearClipPlane) * 0.5f;
Gizmos.DrawWireCube(new Vector3(0, 0, center), new Vector3(camera.orthographicSize * 2 * camera.aspect, camera.orthographicSize * 2, spread));
}
else
{
Gizmos.DrawFrustum(Vector3.zero, camera.fieldOfView, camera.farClipPlane, camera.nearClipPlane, camera.aspect);
}
Gizmos.matrix = temp;
}
#endregion
} // class

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60632382187fbbe46b6079efcb6cc8ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
using System.Collections.Generic;
using UnityEngine;
public class Dot : MonoBehaviour
{
[SerializeField] public bool isDifferent;
[SerializeField] private SpriteRenderer sprite;
[Range(0, 255)]
[SerializeField] private float redValue;
[Range(0, 255)]
[SerializeField] private float greenValue;
[Range(0, 255)]
[SerializeField] private float blueValue;
public void SetDifferent(bool val)
{
isDifferent = val;
}
public Vector2 GetPos()
{
return transform.position;
}
public void ChangeRed(float val)
{
redValue = val;
}
public void ChangeBlue(float val)
{
blueValue = val;
}
public void ChangeGreen(float val)
{
greenValue = val;
}
public void ChangeColor(Color color)
{
sprite.color = color;
}
public void CheckOverlapping()
{
List<Dot> dots = DotsManager.Instance.GetDots();
for (int i = 0; i < dots.Count; i++)
{
if (dots[i] != this)
{
if (Vector2.Distance(transform.position, dots[i].transform.position) < 2.5f)
{
Debug.Log("Overlapping");
DotsManager.Instance.MoveDots(this);
break;
}
}
}
}
private void Start()
{
LeanTween.scale(gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
LeanTween.scale(gameObject, new Vector3(2, 2, 2), 0.5f).setDelay(0.2f).setEaseInOutCubic();
}
private void OnMouseDown()
{
GameManager.Instance.ClickDot(this);
}
public Vector3 GetRGB()
{
return new Vector3(redValue, greenValue, blueValue);
}
private byte FloatToByteColor(float val)
{
return (byte)((val * 255) * 255);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 11518baead38f7c46a03489cc7c09661
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,186 @@
using System.Collections.Generic;
using UnityEngine;
public enum Level
{
Protan, Deutan, Tritan
}
public enum Stage
{
Differentcolor,SameColor
}
public class DotsManager : MonoBehaviour
{
public static DotsManager Instance;
[SerializeField] private int dotsCount;
[SerializeField] private Dot dotsPrefab;
[SerializeField] private float saturationLevel = 50f;
[SerializeField] private Transform parent; // nge spawn dotnya di child ini
[SerializeField] private List<Transform> cornerPosition; //buat nge fixing pas di android
[SerializeField] private List<Dot> dotsSpawned;
[SerializeField] private LevelScriptable currentLevelPlay;
[SerializeField] private List<LevelScriptable> levelList;
[SerializeField] Color selectedColor;
[SerializeField] Color saturatedColor;
private void Awake()
{
Instance = this;
}
public LevelScriptable GetCurrentLevel()
{
return currentLevelPlay;
}
public void StartDots()
{
ChangeMainColor();
SpawnDots();
ChangeDotsColor();
saturatedColor = currentLevelPlay.rgbSaturatedList[0];
Change1Saturation();
}
public void ClearWrongColor()
{
for (int i = 0; i < dotsSpawned.Count; i++)
{
if (!dotsSpawned[i].isDifferent)
{
dotsSpawned[i].gameObject.SetActive(false);
}
}
}
public void SetStage(int index)
{
selectedColor = currentLevelPlay.rgbList[index];
saturatedColor = currentLevelPlay.rgbSaturatedList[index];
dotsCount = currentLevelPlay.dotCount[index];
}
public void StartPlay()
{
currentLevelPlay = levelList[0];
}
public void SetLevel(Level level)
{
if (level == Level.Protan)
{
currentLevelPlay = levelList[0];
}
else if (level == Level.Deutan)
{
currentLevelPlay = levelList[1];
}
else if (level == Level.Tritan)
{
currentLevelPlay = levelList[2];
}
}
public void DecreaseSaturationLevel()
{
saturationLevel *= 0.8f;
}
public Color GetRGB()
{
return selectedColor;
}
public void IncreaseSaturationLevel()
{
saturationLevel *= 1.2f;
}
public void ChangeColor(Color val)
{
selectedColor = val;
}
private void Update()
{
if (Input.GetKey(KeyCode.Space))
{
ClearDots();
SpawnDots();
Change1Saturation();
}
}
public void NextStage()
{
ClearDots();
SpawnDots();
Change1Saturation();
}
public void Change1Saturation()
{
for (int i = 0; i < dotsSpawned.Count; i++)
{
dotsSpawned[i].SetDifferent(false);
}
int rIndex = Random.Range(0, dotsSpawned.Count);
dotsSpawned[rIndex].ChangeColor(saturatedColor);
dotsSpawned[rIndex].SetDifferent(true);
Debug.Log("CurStage : 1");
}
public void ChangeMainColor()
{
if (GameManager.Instance.currentLevel == Level.Protan)
{
selectedColor = currentLevelPlay.rgbList[0];
}
else if (GameManager.Instance.currentLevel == Level.Deutan)
{
selectedColor = currentLevelPlay.rgbList[0];
//selectedColor = Color.yellow;
}
else if (GameManager.Instance.currentLevel == Level.Tritan)
{
selectedColor = currentLevelPlay.rgbList[0];
//selectedColor = Color.blue;
}
}
public void ChangeDotsColor()
{
for (int i = 0; i < dotsSpawned.Count; i++)
{
dotsSpawned[i].ChangeColor(selectedColor);
}
}
public List<Dot> GetDots()
{
return dotsSpawned;
}
public void ClearDots()
{
foreach (Dot d in dotsSpawned)
{
Destroy(d.gameObject);
}
dotsSpawned.Clear();
}
private void SpawnDots()
{
for (int i = 0; i < dotsCount; i++)
{
Dot dot = Instantiate(dotsPrefab, parent);
dot.transform.position = GetNewPosition();
dotsSpawned.Add(dot);
dot.ChangeColor(selectedColor);
dot.CheckOverlapping();
}
}
public void MoveDots(Dot dot)
{
dot.transform.position = GetNewPosition();
dot.CheckOverlapping();
}
Vector2 GetNewPosition()
{
Vector2 newpos = new Vector2(Random.Range(cornerPosition[0].position.x, cornerPosition[1].position.x), Random.Range(cornerPosition[2].position.y, cornerPosition[0].position.y));
return newpos;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f161491c5d2b104d9cfaed230128f89
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,455 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
[System.Serializable]
public class Answer
{
public bool correct;
public Level level;
public Stage stageLevel;
public int stage;
public int globalStage;
public float responseTime;
public Answer(bool correct, Level level, Stage stageLevel,int stage, int globalStage,float responseTime)
{
this.correct = correct;
this.level = level;
this.stageLevel = stageLevel;
this.stage = stage;
this.globalStage = globalStage;
this.responseTime = responseTime;
}
}
public class GameManager : MonoBehaviour
{
public event Action OnDotClicked;
public event Action<bool, int> OnAnswer;
public event Action OnNext;
public event Action OnLevelCleared;
public event Action<int> OnGlobalStageAdded;
public event Action<float> OnShowResult;
public static GameManager Instance;
public Level currentLevel;
public Stage currentStageLevel;
public int currentStage;
public int currentGlobalStage;
public int currentDifficulty;
[SerializeField] private DotsManager dotsManager;
[SerializeField] private SameColorDotsManager sameColorDotsManager;
[SerializeField] private GuideManager guideManager;
[SerializeField] private MainMenuUI mainMenuUI;
[SerializeField] private GameUI gameUI;
[SerializeField] private GuideUI guideUI;
[SerializeField] private CameraColorController camColorController;
[SerializeField] private ExampleDisplay exampleDisplay;
[SerializeField] private SalahDisplay salahDisplay;
[SerializeField] private float protanPoint;
[SerializeField] private float deutanPoint;
[SerializeField] private float tritanPoint;
[SerializeField] private bool isAnswering;
private Stack<Color> rgbStored = new Stack<Color>();
[SerializeField] private List<Answer> answers = new List<Answer>();
[SerializeField] private float showGuideMaxCooldown;
[SerializeField] private float showGuidecurrentCooldown;
[SerializeField] private bool isStart;
[SerializeField] private bool isChoosing;
[SerializeField] private bool guideShowing;
[SerializeField] private float responseTime;
[SerializeField] private ParticleSystem confettiParticle;
private void Awake()
{
Instance = this;
}
private void OnDestroy()
{
OnDotClicked = null;
OnShowResult = null;
OnNext = null;
OnLevelCleared = null;
OnGlobalStageAdded = null;
}
private void Update()
{
if (isStart && isChoosing)
{
if (showGuidecurrentCooldown > 0)
{
showGuidecurrentCooldown -= Time.deltaTime;
}
else if (showGuidecurrentCooldown < 0)
{
Debug.Log("Showing Guide");
AudioManager.Instance.PlaySfx("Guide Show");
if (currentStageLevel == Stage.Differentcolor)
{
guideUI.Show("Tekan Lingkaran yang warnanya\n berbeda dari yang lain!");
}
else {
guideUI.Show("Tekan Lingkaran yang\n warnanya sama!");
}
guideShowing = true;
showGuidecurrentCooldown = 0;
}
responseTime += Time.deltaTime;
}
}
public void ShowGuide()
{
showGuidecurrentCooldown = 0.1f;
}
public void HideGuide()
{
if (guideShowing)
{
guideUI.Hide();
ResetGuide();
}
}
public void ResetGuide()
{
showGuidecurrentCooldown = 5;
}
public void NextStage()
{
Debug.Log("NextStage");
GameManager.Instance.StartStage(Stage.Differentcolor);
}
private void Start()
{
Application.targetFrameRate = 60;
LeanTween.reset();
gameUI.Hide();
mainMenuUI.Show();
AudioManager.Instance.PlayMusic("Music 1");
}
public void OpenGuide()
{
guideManager.Show();
}
public void CloseGuide()
{
guideManager.Hide();
}
public void QuitGame()
{
Application.Quit();
}
public void StartStage(Stage stage)
{
if (stage == Stage.Differentcolor)
{
currentStageLevel = stage;
camColorController.ChangeColor(Level.Protan);
dotsManager.StartDots();
ShowGuide();
}
else if (stage == Stage.SameColor)
{
currentStageLevel = stage;
dotsManager.ClearDots();
sameColorDotsManager.Play();
ShowGuide();
}
}
public void StartGame()
{
AudioManager.Instance.StopMusic();
AudioManager.Instance.PlayMusic("Music 2");
gameUI.Show();
currentLevel = Level.Protan;
sameColorDotsManager.ResetLevel();
dotsManager.StartPlay();
currentStage = 1;
currentDifficulty = 1;
protanPoint = 0.5f;
deutanPoint = 0.5f;
tritanPoint = 0.5f;
currentGlobalStage = 1;
StartStage(Stage.Differentcolor);
dotsManager.SetStage(currentDifficulty - 1);
isChoosing = true;
OnDotClicked?.Invoke();
mainMenuUI.Hide();
OnGlobalStageAdded.Invoke(currentGlobalStage);
ClearAnswer();
isStart = true;
guideShowing = true;
guideUI.Show();
}
private void ClearAnswer()
{
answers.Clear();
}
public void SetIsChoosing(bool val)
{
isChoosing = val;
}
public void AnswerSameColorDots(bool correct)
{
answers.Add(new Answer(correct, currentLevel, currentStageLevel, currentStage,currentGlobalStage, responseTime));
this.responseTime = 0;
}
private void AddAnswer(bool correct, Level level,Stage stageLevel, int stage, int globalStage,float responseTime)
{
answers.Add(new Answer(correct, level,stageLevel, stage, globalStage, responseTime));
this.responseTime = 0;
}
public void GoToMenu()
{
gameUI.Hide();
mainMenuUI.Show();
AudioManager.Instance.StopMusic();
AudioManager.Instance.PlayMusic("Music 1");
camColorController.ChangeColorToMenu();
}
public void ClickDot(Dot dot)
{
if (isAnswering)
return;
if (guideShowing)
{
guideUI.Hide();
}
if (currentStage > 4)
{
isAnswering = true;
isChoosing = false;
if (dot.isDifferent)
{
OnAnswer?.Invoke(true, currentStage - 1);
AddAnswer(true, currentLevel, currentStageLevel, currentStage, currentGlobalStage, responseTime);
dotsManager.ClearDots();
if (currentLevel == Level.Protan)
{
StartCoroutine(NextLevelDelay(Level.Deutan));
}
else if (currentLevel == Level.Deutan)
{
StartCoroutine(NextLevelDelay(Level.Tritan));
}
else if (currentLevel == Level.Tritan)
{
StartCoroutine(LastStageDelay());
//StartCoroutine(ShowResultDelay());
}
AudioManager.Instance.PlaySfx("Jawab Benar");
}
else
{
OnAnswer?.Invoke(false, currentStage - 1);
AddAnswer(false, currentLevel, currentStageLevel, currentStage, currentGlobalStage, responseTime);
dotsManager.ClearWrongColor();
if (currentLevel == Level.Protan)
{
StartCoroutine(NextLevelDelay(Level.Deutan));
}
else if (currentLevel == Level.Deutan)
{
StartCoroutine(NextLevelDelay(Level.Tritan));
}
else if (currentLevel == Level.Tritan)
{
StartCoroutine(LastStageDelay());
//StartCoroutine(ShowResultDelay());
}
AudioManager.Instance.PlaySfx("Jawab Salah");
}
Debug.Log("Level Clear!");
}
else
{
isChoosing = false;
if (dot.isDifferent)
{
OnAnswer?.Invoke(true, currentStage - 1);
Debug.Log("Jawaban Benar");
Next(true, dot);
AudioManager.Instance.PlaySfx("Jawab Benar");
}
else
{
OnAnswer?.Invoke(false, currentStage - 1);
Debug.Log("Jawaban Salah");
if (currentLevel == Level.Protan)
{
protanPoint -= 0.1f;
}
else if (currentLevel == Level.Deutan)
{
deutanPoint -= 0.1f;
}
else if (currentLevel == Level.Tritan)
{
tritanPoint -= 0.1f;
}
Next(false, dot);
AudioManager.Instance.PlaySfx("Jawab Salah");
}
}
OnDotClicked?.Invoke();
}
public void ViewGameResult()
{
ShowResult(protanPoint + deutanPoint + tritanPoint + sameColorDotsManager.score);
}
public List<Answer> GetAnswers()
{
return answers;
}
public IEnumerator ShowResultDelay()
{
isStart = false;
dotsManager.ClearDots();
yield return new WaitForSeconds(2);
exampleDisplay.Hide();
ShowResult(protanPoint + deutanPoint + tritanPoint + sameColorDotsManager.score);
dotsManager.ClearDots();
Debug.Log("Clear! Show Result");
isAnswering = false;
OnNext?.Invoke();
}
public void Next(bool isCorrect, Dot dot)
{
isAnswering = true;
AddAnswer(isCorrect, currentLevel, currentStageLevel, currentStage, currentGlobalStage, responseTime);
if (isCorrect)
{
dotsManager.ClearDots();
StartCoroutine(NextCorrectDelay(dot));
}
else
{
dotsManager.ClearWrongColor();
StartCoroutine(NextIncorrectDelay());
}
}
public IEnumerator NextCorrectDelay(Dot dot)
{
yield return new WaitForSeconds(2f);
exampleDisplay.Hide();
dotsManager.DecreaseSaturationLevel();
currentStage++;
currentDifficulty++;
Vector3 rgb = dot.GetRGB();
rgbStored.Push(dotsManager.GetRGB());
currentGlobalStage++;
OnGlobalStageAdded.Invoke(currentGlobalStage);
dotsManager.SetStage(currentDifficulty - 1);
dotsManager.NextStage();
OnNext?.Invoke();
isAnswering = false;
isChoosing = true;
showGuidecurrentCooldown = showGuideMaxCooldown;
}
public void AddGlobalStage()
{
currentGlobalStage++;
OnGlobalStageAdded.Invoke(currentGlobalStage);
}
public IEnumerator NextIncorrectDelay()
{
yield return new WaitForSeconds(3f);
dotsManager.IncreaseSaturationLevel();
currentStage++;
if (currentDifficulty > 1)
{
currentDifficulty--;
}
dotsManager.SetStage(currentDifficulty - 1);
dotsManager.NextStage();
OnNext?.Invoke();
currentGlobalStage++;
OnGlobalStageAdded.Invoke(currentGlobalStage);
isAnswering = false;
isChoosing = true;
showGuidecurrentCooldown = showGuideMaxCooldown;
}
public void ChangeLevel()
{
if (currentLevel == Level.Protan)
{
currentLevel = Level.Deutan;
dotsManager.SetLevel(currentLevel);
}
else if (currentLevel == Level.Deutan)
{
currentLevel = Level.Tritan;
dotsManager.SetLevel(currentLevel);
}
else if (currentLevel == Level.Tritan)
{
StartCoroutine(LastStageDelay());
//StartCoroutine(ShowResultDelay());
}
}
public IEnumerator NextLevelDelay(Level level)
{
camColorController.ChangeColor(level);
yield return new WaitForSeconds(2f);
currentGlobalStage++;
OnGlobalStageAdded.Invoke(currentGlobalStage);
currentStage = 1;
currentDifficulty = 1;
dotsManager.SetLevel(currentLevel);
dotsManager.SetStage(currentDifficulty - 1);
dotsManager.NextStage();
OnNext?.Invoke();
isAnswering = false;
isChoosing = true;
exampleDisplay.Hide();
showGuidecurrentCooldown = showGuideMaxCooldown;
if (currentStageLevel == Stage.Differentcolor)
{
StartStage(Stage.SameColor);
}
}
public IEnumerator LastStageDelay()
{
yield return new WaitForSeconds(2f);
//currentGlobalStage++;
//OnGlobalStageAdded.Invoke(currentGlobalStage);
//currentStage = 1;
//currentDifficulty = 1;
dotsManager.SetLevel(currentLevel);
dotsManager.SetStage(currentDifficulty - 1);
dotsManager.NextStage();
OnNext?.Invoke();
isAnswering = false;
isChoosing = true;
exampleDisplay.Hide();
showGuidecurrentCooldown = showGuideMaxCooldown;
if (currentStageLevel == Stage.Differentcolor)
{
StartStage(Stage.SameColor);
}
}
public int GetGlobalStage()
{
return currentGlobalStage;
}
public void ShowResult(float result)
{
isStart = false;
confettiParticle.Play();
OnShowResult?.Invoke(result);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 498f2e3bf6089bd419b9c12686ec74a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
[CreateAssetMenu(fileName = "Level", menuName = "ScriptableObjects/Level", order = 1)]
public class LevelScriptable : ScriptableObject
{
public List<Color> rgbList;
public List<Color> rgbSaturatedList;
public List<int> dotCount;
public List<Sprite> displaySprite;
public List<string> displayString;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 63bbcdf74f6e3cb42aac3213512180d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "MatchDotLevel", menuName = "ScriptableObjects/MatchDotLevel", order = 1)]
public class MatchDotLevelScriptable : ScriptableObject
{
public int colorCount;
public List<Color> colors = new List<Color>();
public List<int> id = new List<int>();
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad389b71d712964409097bb8596a101d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SameColorDot : MonoBehaviour
{
public int index;
public int id;
public SpriteRenderer sprite;
private SameColorDotsManager manager;
public void SetData(SameColorDotsManager manager)
{
this.manager = manager;
}
public void SetId(int id)
{
this.id = id;
}
private void Start()
{
LeanTween.scale(gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
LeanTween.scale(gameObject, new Vector3(2, 2, 2), 0.5f).setDelay(0.2f).setEaseInOutCubic();
}
public void ChangeColor(Color color)
{
sprite.color = color;
}
public Color GetColor()
{
return sprite.color;
}
private void OnMouseDown()
{
manager.SelectColor(this);
}
public void Select()
{
LeanTween.scale(gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
}
public void Deselect()
{
LeanTween.scale(gameObject, new Vector3(2f, 2f, 2f), 0.25f).setEaseInOutCubic();
}
public void Destroying()
{
// LeanTween.scale(gameObject, new Vector3(2f, 2f, 2f), 0.25f).setEaseInOutCubic();
LeanTween.scale(gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
StartCoroutine(DestroyDelay());
}
private IEnumerator DestroyDelay()
{
yield return new WaitForSeconds(0.25f);
LeanTween.scale(gameObject, new Vector3(0.05f, 0.05f, 0.05f), 1f).setEaseInOutCubic();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c940e254c8f971d45a9cc975aa3de997
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,150 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SameColorDotsManager : MonoBehaviour
{
public float score;
[SerializeField] private bool isPlaying;
[SerializeField] private SameColorDot sameColorDotPrefab;
[SerializeField] private List<Transform> places = new List<Transform>();
[SerializeField] private List<SameColorDot> dotInScene = new List<SameColorDot>();
[SerializeField] List<SameColorDot> dotTemp = new List<SameColorDot>();
[SerializeField] Queue<SameColorDot> dotQueue = new Queue<SameColorDot>();
[SerializeField] private int level;
[SerializeField] private List<MatchDotLevelScriptable> MatchDotLevels = new List<MatchDotLevelScriptable>();
[SerializeField] private SalahDisplay salahDisplay;
[SerializeField] private SameDotsBenarDisplay exampleDisplay;
[SerializeField] private SameColorDot dotSelected;
[SerializeField] private bool isColorSelected;
[SerializeField] private bool isSelectingColor;
[SerializeField] private int pairLeft;
//[SerializeField] private
public void SelectColor(SameColorDot dot)
{
if (isSelectingColor) return;
if (!isColorSelected)
{
isColorSelected = true;
dotSelected = dot;
dot.Select();
AudioManager.Instance.PlaySfx("Click");
}
else
{
if (dotSelected == dot) return;
AudioManager.Instance.PlaySfx("Click");
StartCoroutine(CheckColorDelay(dot));
}
}
private IEnumerator CheckColorDelay(SameColorDot dot)
{
isSelectingColor = true;
dot.Select();
GameManager.Instance.ResetGuide();
if (dotSelected.id == dot.id)
{
exampleDisplay.Display();
dotSelected.Destroying();
dot.Destroying();
AudioManager.Instance.PlaySfx("Jawab Benar");
GameManager.Instance.AnswerSameColorDots(true);
GameManager.Instance.SetIsChoosing(false);
}
else
{
salahDisplay.Display();
AudioManager.Instance.PlaySfx("Jawab Salah");
GameManager.Instance.AnswerSameColorDots(false);
GameManager.Instance.SetIsChoosing(false);
}
yield return new WaitForSeconds(1f);
if (dotSelected.id == dot.id)
{
//Correct
exampleDisplay.Hide();
Destroy(dotSelected.gameObject);
Destroy(dot.gameObject);
isColorSelected = false;
pairLeft--;
GameManager.Instance.HideGuide();
GameManager.Instance.AddGlobalStage();
}
else
{
//Incorrect
salahDisplay.Hide();
dotSelected.Deselect();
dot.Deselect();
isColorSelected = false;
dotSelected = null;
if (score > 0)
{
score -= 0.1f;
}
}
if (pairLeft == 0)
{
if (level < 2)
{
AddLevel();
GameManager.Instance.ChangeLevel();
GameManager.Instance.NextStage();
}
else
{
GameManager.Instance.ViewGameResult();
}
}
GameManager.Instance.SetIsChoosing(true);
isSelectingColor = false;
}
public void AddLevel()
{
level++;
}
public void ResetLevel()
{
level = 0;
}
public void Play()
{
pairLeft = 6;
dotTemp.Clear();
dotInScene.Clear();
for (int i = 0; i < places.Count; i++)
{
SameColorDot dot = Instantiate(sameColorDotPrefab, places[i].transform.position, Quaternion.identity);
dot.SetData(this);
dot.index = i;
dotTemp.Add(dot);
dotInScene.Add(dot);
}
for (int i = 0; i < dotTemp.Count;)
{
int r = Random.Range(0, dotTemp.Count);
dotQueue.Enqueue(dotTemp[r]);
dotTemp.RemoveAt(r);
}
Debug.Log("Dot Count : " + dotQueue.Count);
int index = 0;
while (dotQueue.Count > 0)
{
SameColorDot dot = dotQueue.Dequeue();
dot.ChangeColor(MatchDotLevels[level].colors[index]);
dot.SetId(MatchDotLevels[level].id[index]);
index++;
Debug.Log("Dequeued Dot Index : " + dot.index);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91732c6d0b3f7c7419fa292552b1492b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using UnityEngine;
public class ScaleToFitScreen : MonoBehaviour
{
private SpriteRenderer sr;
private void Start()
{
sr = GetComponent<SpriteRenderer>();
// world height is always camera's orthographicSize * 2
float worldScreenHeight = Camera.main.orthographicSize * 2;
// world width is calculated by diving world height with screen heigh
// then multiplying it with screen width
float worldScreenWidth = worldScreenHeight / Screen.height * Screen.width;
// to scale the game object we divide the world screen width with the
// size x of the sprite, and we divide the world screen height with the
// size y of the sprite
transform.localScale = new Vector3(
worldScreenWidth / sr.sprite.bounds.size.x,
worldScreenHeight / sr.sprite.bounds.size.y, 1);
}
} // class

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 802c845bdaa9b53438a2e6cf6e257bb2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aeb10b33b6842ea4785e943bd994d66a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a500e5c8b294394a879dfb76a17af09
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 63bbcdf74f6e3cb42aac3213512180d4, type: 3}
m_Name: Deutan
m_EditorClassIdentifier:
rgbList:
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
- {r: 0.33299276, g: 0.86415094, b: 0.05706645, a: 1}
rgbSaturatedList:
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
- {r: 0.42558023, g: 0.98490566, b: 0.16167314, a: 1}
dotCount: 04000000040000000500000005000000060000000600000005000000050000000600000006000000
displaySprite:
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
- {fileID: 21300000, guid: 0f3af4fc4419bf940bba624a9ac98748, type: 3}
displayString:
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau
- Brokoli berwarna Hijau

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9416d429868f8c6499c95f55002e4c9c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 63bbcdf74f6e3cb42aac3213512180d4, type: 3}
m_Name: Protan
m_EditorClassIdentifier:
rgbList:
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
- {r: 0.8113208, g: 0, b: 0.0042478093, a: 1}
rgbSaturatedList:
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
- {r: 0.93207544, g: 0.19520827, b: 0.19906625, a: 1}
dotCount: 04000000040000000500000005000000060000000600000005000000050000000600000006000000
displaySprite:
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: e4464c541f39f9745b541ff6a798507e, type: 3}
- {fileID: 21300000, guid: 6c8a85fb7fc9d75449a1850506698aad, type: 3}
- {fileID: 21300000, guid: ba4a9cdc6e2777c45b17820bd3b18667, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: e4464c541f39f9745b541ff6a798507e, type: 3}
- {fileID: 21300000, guid: 6c8a85fb7fc9d75449a1850506698aad, type: 3}
- {fileID: 21300000, guid: b847208fce4f21b448ff26a643810308, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: e4464c541f39f9745b541ff6a798507e, type: 3}
displayString:
- Buah apel berwarna merah
- Buah Strawberi berwarna merah
- Tomat berwarna merah
- Kacang berwarna Coklat
- Buah apel berwarna merah
- Buah Strawberi berwarna merah
- Tomat berwarna merah
- Cabai berwarna merah
- Buah apel berwarna merah
- Buah Strawberi berwarna merah

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7133b420ee80789419dbfee4aa31bbc4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 63bbcdf74f6e3cb42aac3213512180d4, type: 3}
m_Name: Tritan
m_EditorClassIdentifier:
rgbList:
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
- {r: 0.022107378, g: 0.78113204, b: 0.71408993, a: 1}
rgbSaturatedList:
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
- {r: 0.24705881, g: 0.94335365, b: 1, a: 1}
dotCount: 04000000040000000500000005000000060000000600000005000000050000000600000006000000
displaySprite:
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
- {fileID: 21300000, guid: c3f44276ad38a694fa113bc758a5c4fe, type: 3}
displayString:
-
-
-
-
-
-
-
-
-
-

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: afa2f00556839da47a6d93948f14950d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1747ebb3a7678ed42835ddbd8c743ad9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad389b71d712964409097bb8596a101d, type: 3}
m_Name: MatchDotLevel 1
m_EditorClassIdentifier:
colorCount: 12
colors:
- {r: 1, g: 0.12631074, b: 0.073584795, a: 1}
- {r: 1, g: 0.1254902, b: 0.07450981, a: 1}
- {r: 0.89433956, g: 0.261552, b: 0.3003623, a: 1}
- {r: 0.89411765, g: 0.2627451, b: 0.3019608, a: 1}
- {r: 0.9924528, g: 0.35165524, b: 0.2902455, a: 1}
- {r: 0.99607843, g: 0.3529412, b: 0.29411766, a: 1}
- {r: 0.8867924, g: 0.22277398, b: 0.2058027, a: 1}
- {r: 0.8862745, g: 0.22352941, b: 0.20392157, a: 1}
- {r: 0.96981126, g: 0.26898536, b: 0.45062613, a: 1}
- {r: 0.96862745, g: 0.27058825, b: 0.4509804, a: 1}
- {r: 1, g: 0.18823528, b: 0.55308914, a: 1}
- {r: 1, g: 0.1882353, b: 0.5568628, a: 1}
id: 010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9dfb5522c5ec35b4fb7d079afb4e38d4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad389b71d712964409097bb8596a101d, type: 3}
m_Name: MatchDotLevel 2
m_EditorClassIdentifier:
colorCount: 12
colors:
- {r: 0.3157891, g: 0.99215686, b: 0.21568628, a: 1}
- {r: 0.31764707, g: 0.99215686, b: 0.2153434, a: 1}
- {r: 0.77703065, g: 0.99215686, b: 0.627451, a: 1}
- {r: 0.7764706, g: 0.99215686, b: 0.627451, a: 1}
- {r: 0.8433925, g: 0.9764706, b: 0.5294118, a: 1}
- {r: 0.84705883, g: 0.9764706, b: 0.5294118, a: 1}
- {r: 0.6, g: 0.78431374, b: 0.40784314, a: 1}
- {r: 0.59879977, g: 0.78113204, b: 0.4053043, a: 1}
- {r: 0.50884163, g: 1, b: 0.45882356, a: 1}
- {r: 0.50980395, g: 1, b: 0.45882356, a: 1}
- {r: 0.6441413, g: 1, b: 0.33725488, a: 1}
- {r: 0.6431373, g: 1, b: 0.3372549, a: 1}
id: 010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 985b55fe284d6d9418928b9f794746dc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad389b71d712964409097bb8596a101d, type: 3}
m_Name: MatchDotLevel 3
m_EditorClassIdentifier:
colorCount: 12
colors:
- {r: 0.6698113, g: 1, b: 0.950717, a: 1}
- {r: 0.67058825, g: 1, b: 0.9490196, a: 1}
- {r: 0.627451, g: 0.99215686, b: 0.7926314, a: 1}
- {r: 0.627451, g: 0.99215686, b: 0.7921569, a: 1}
- {r: 0.67731583, g: 0.7807961, b: 0.94716984, a: 1}
- {r: 0.6784314, g: 0.78431374, b: 0.9490196, a: 1}
- {r: 0.72561765, g: 0.75381833, b: 0.79622644, a: 1}
- {r: 0.7294118, g: 0.75686276, b: 0.8, a: 1}
- {r: 0.65389097, g: 0.9185385, b: 0.9547169, a: 1}
- {r: 0.654902, g: 0.92156863, b: 0.95686275, a: 1}
- {r: 0.33725488, g: 1, b: 0.76732063, a: 1}
- {r: 0.3372549, g: 1, b: 0.76862746, a: 1}
id: 010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb79965c5e0ed2949959edb9ff4c494d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b3ed0d23cf6073d42b1a8b9cd64e8992
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using TMPro;
using UnityEngine.UI;
public class AverageDataDisplay : MonoBehaviour
{
[SerializeField] private List<Answer> data = new List<Answer>();
[SerializeField] private List<float> responseTimeList = new List<float>();
[SerializeField] private TextMeshProUGUI stageText;
[SerializeField] private TextMeshProUGUI jumlahSalahText;
[SerializeField] private TextMeshProUGUI responseTimeText;
public void SetData(List<Answer> data, Level level)
{
int jumlahSalah = 0;
for (int i = 0; i < data.Count; i++)
{
if (data[i].level == level)
{
this.data.Add(data[i]);
responseTimeList.Add(data[i].responseTime);
if (!data[i].correct)
{
jumlahSalah++;
}
}
}
float average = responseTimeList.Average();
stageText.text = "Stage : " + level.ToString();
jumlahSalahText.text = "Jumlah Salah : " + jumlahSalah.ToString();
responseTimeText.text = "Rata Rata Response Time : " + average.ToString("F1") + "s";
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 104d6574fb136aa46b03339eb07ed2c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraColorController : MonoBehaviour
{
[SerializeField] private Camera cam;
[SerializeField] private Color menuColor;
[SerializeField] private Color colorProtan;
[SerializeField] private Color colorDeutan;
[SerializeField] private Color colorTritan;
[SerializeField] private float duration;
public void ChangeColor(Level level)
{
if (level == Level.Protan)
{
LeanTween.value(gameObject, UpdateColor, menuColor, colorProtan, duration)
.setEase(LeanTweenType.easeInOutQuad);
} else if (level == Level.Deutan)
{
LeanTween.value(gameObject, UpdateColor, colorProtan, colorDeutan, duration)
.setEase(LeanTweenType.easeInOutQuad);
} else if (level == Level.Tritan)
{
LeanTween.value(gameObject, UpdateColor, colorDeutan, colorTritan, duration)
.setEase(LeanTweenType.easeInOutQuad);
}
}
public void ChangeColorToMenu()
{
LeanTween.value(gameObject, UpdateColor, colorTritan, menuColor, duration)
.setEase(LeanTweenType.easeInOutQuad);
}
public void UpdateColor(Color color)
{
cam.backgroundColor = color;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1141b8ce6e53e2a499ea762a5349fb7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class DetailDataDisplay : MonoBehaviour
{
[SerializeField] private Answer data;
[SerializeField] private TextMeshProUGUI levelText;
[SerializeField] private TextMeshProUGUI stageText;
[SerializeField] private TextMeshProUGUI isCorrectText;
[SerializeField] private TextMeshProUGUI responseTimeText;
[SerializeField] private Image bg;
[SerializeField] private Color differentColorModeColor;
[SerializeField] private Color sameColorModeColor;
public void SetData(Answer data)
{
this.data = data;
levelText.text = "Level " +data.globalStage.ToString();
stageText.text = "Stage " +data.level.ToString();
if (data.correct)
{
isCorrectText.text = "Menjawab Benar";
}
else {
isCorrectText.text = "Menjawab Salah ";
}
responseTimeText.text = "Response Time :" + data.responseTime.ToString("F1")+"s";
if (data.stageLevel == Stage.Differentcolor)
{
bg.color = differentColorModeColor;
}
else {
bg.color = sameColorModeColor;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50fcd948d6d41284193f80addb075a3c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ExampleDisplay : UIManager
{
[SerializeField] private Image image;
[SerializeField] private Image mascotImage;
[SerializeField] private Image thumbsImage;
[SerializeField] private TextMeshProUGUI displayText;
public void Display(Sprite sprite,string displayString)
{
Show();
LeanTween.scale(image.gameObject, new Vector3(1.5f,1.5f,1.5f), 0.25f).setEaseInOutCubic();
//LeanTween.scale(mascotImage.gameObject, new Vector3(0.75f, 0.75f, 0.75f), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0,0,30), 0.25f).setEaseInOutCubic();
LeanTween.rotate(mascotImage.gameObject, new Vector3(0,0,30), 0.25f).setEaseInOutCubic();
LeanTween.scale(image.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.scale(displayText.gameObject, new Vector3(0.75f, 0.75f, 0.75f), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.rotate(mascotImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.scale(displayText.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
//LeanTween.scale(mascotImage.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
image.sprite = sprite;
displayText.text = displayString;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 21f171aa80bb06041b97cb6bfcb0c676
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,139 @@
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class GameUI : UIManager
{
[SerializeField] private GameManager gameManager;
[SerializeField] private DotsManager dotsManager;
[SerializeField] private TextMeshProUGUI levelText;
[SerializeField] private TextMeshProUGUI stageText;
[SerializeField] private TextMeshProUGUI resultText;
[SerializeField] private TextMeshProUGUI rankText;
[SerializeField] private TextMeshProUGUI correctText;
[SerializeField] private GameObject mainMenuButton;
[SerializeField] private GameObject showSummaryButton;
[SerializeField] private Slider progressBar;
[SerializeField] private float targetProgress;
private float fillspeed = 1f;
[SerializeField] private SummaryDisplay summaryDisplay;
[SerializeField] private SalahDisplay salahDisplay;
[SerializeField] private ExampleDisplay exampleDisplay;
private void Awake()
{
gameManager.OnShowResult += ShowResult;
gameManager.OnAnswer += ShowCorrect;
gameManager.OnNext += Next;
gameManager.OnGlobalStageAdded += DisplayProgressBar;
}
private void DisplayProgressBar(int val)
{
float progress = (float)((float)val / 33f);
targetProgress = progress;
}
private void Update()
{
progressBar.value = Mathf.Lerp(progressBar.value, targetProgress, fillspeed * Time.deltaTime);
}
public void OpenSummary()
{
summaryDisplay.Show();
}
public void CloseSummary()
{
summaryDisplay.Hide();
}
private void Start()
{
ToggleMainMenuButton(false);
ToggleSummaryButton(false);
}
public void ToggleMainMenuButton(bool val)
{
mainMenuButton.SetActive(val);
}
public void ToggleSummaryButton(bool val)
{
showSummaryButton.SetActive(val);
}
public void Next()
{
ResetCorrect();
AudioManager.Instance.PlaySfx("Mulai Game");
}
public void GoToMainMenu()
{
ToggleSummaryButton(false);
ToggleMainMenuButton(false);
resultText.text = "";
rankText.text = "";
GameManager.Instance.GoToMenu();
}
public void ShowCorrect(bool val,int currentStage)
{
levelText.text = "";
stageText.text = "";
if (val)
{
exampleDisplay.Display(dotsManager.GetCurrentLevel().displaySprite[currentStage], dotsManager.GetCurrentLevel().displayString[currentStage]);
}
else {
salahDisplay.Display();
}
}
public void ResetCorrect()
{
salahDisplay.Hide();
exampleDisplay.Hide();
correctText.text = "";
}
public void ShowResult(float result)
{
ResetCorrect();
ToggleMainMenuButton(true);
ToggleSummaryButton(true);
levelText.text = "";
stageText.text = "";
string rank;
if (result > 2.8f)
{
rank = "A";
}
else if (result > 2.4f)
{
rank = "B";
}
else if (result > 1.8f)
{
rank = "C";
}
else if (result > 1f)
{
rank = "D";
}
else {
rank = "E";
}
rankText.text = rank.ToString();
float finalScore = (result / 3f) * 100f;
resultText.text = "Kamu Dapat " +rank +" , dengan skor "+ finalScore.ToString("F0");
//fuzzy logic
if (result > 2.4f)
{
resultText.text += "\n(Tinggi, Mata aman)";
}
else if (result > 1.5f)
{
resultText.text += "\n(Sedang, Zona Abu Abu)";
}
else {
resultText.text += "\n(Rendah, Buta Warna)";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b0978fda385cc544188a2090dbc29a5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class GuideManager : UIManager
{
[SerializeField] private Image imageDisplay;
[SerializeField] private TextMeshProUGUI textDisplay;
[SerializeField] private TextMeshProUGUI indexDisplay;
[TextArea]
[SerializeField] private string[] textList;
[SerializeField] private Sprite[] imageList;
[SerializeField] private int currentIndex;
public override void Show()
{
base.Show();
currentIndex = 0;
DisplayGuide();
}
public void Next()
{
if (currentIndex < imageList.Length - 1)
{
currentIndex++;
AudioManager.Instance.PlaySfx("Click");
DisplayGuide();
}
}
public void Prev()
{
if (currentIndex > 0)
{
currentIndex--;
DisplayGuide();
AudioManager.Instance.PlaySfx("Click");
}
}
private void DisplayGuide()
{
imageDisplay.sprite = imageList[currentIndex];
textDisplay.text = textList[currentIndex];
indexDisplay.text = "(" + (currentIndex + 1) + " / " + imageList.Length + " )";
}
public void Close()
{
AudioManager.Instance.PlaySfx("Click");
Hide();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07ee3511a775cd24a8552dfe9196db35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class GuideUI : UIManager
{
[SerializeField] private TextMeshProUGUI guideText;
public void Show(string theText)
{
base.Show();
guideText.text = theText;
guideText.transform.localScale = new Vector3(1, 1, 1);
LeanTween.scale(guideText.gameObject, new Vector3(1.25f, 1.25f, 1.25f), 1).setLoopPingPong();
}
public override void Hide()
{
base.Hide();
LeanTween.cancel(guideText.gameObject);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9476eb98d272a16419b46074ff30078a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainMenuUI : UIManager
{
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d48241b288895b64ba70bb09c4843044
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseUI : UIManager
{
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04c18e6eaf4774447b6c5917e9655ade
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using UnityEngine;
using TMPro;
using System.Collections.Generic;
using System.Collections;
using UnityEngine.UI;
public class SalahDisplay : UIManager
{
[SerializeField] private TextMeshProUGUI salahText;
[SerializeField] private Image mascotImage;
[SerializeField] private Image thumbsImage;
[SerializeField] private List<string> variasiText = new List<string>();
public void Display()
{
Show();
salahText.text = "Kamu Salah";
LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
StartCoroutine(SalahDelay());
}
private IEnumerator SalahDelay()
{
yield return new WaitForSeconds(1f);
LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
salahText.text = variasiText[Random.Range(0, variasiText.Count)];
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 35b8222270fb18b42a6aded426356fa9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class SameDotsBenarDisplay : UIManager
{
[SerializeField] private TextMeshProUGUI salahText;
[SerializeField] private Image mascotImage;
[SerializeField] private Image thumbsImage;
//[SerializeField] private List<string> variasiText = new List<string>();
public void Display()
{
Show();
//salahText.text = "Kamu Salah";
//LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
//LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
StartCoroutine(SalahDelay());
}
private IEnumerator SalahDelay()
{
yield return new WaitForSeconds(1f);
//LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
//LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
// salahText.text = variasiText[Random.Range(0, variasiText.Count)];
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6b11ee3b5d37a2a46a5a361a943d9093
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class SummaryDisplay : UIManager
{
[SerializeField] private Transform parent;
[SerializeField] private DetailDataDisplay detailDataDisplayPrefab;
[SerializeField] private AverageDataDisplay averageDataDisplayPrefab;
[SerializeField] private TextMeshProUGUI showText;
[SerializeField] private bool isShowingAverage;
public override void Show()
{
base.Show();
isShowingAverage = true;
ShowAverage();
}
public void ToggleShow()
{
if (isShowingAverage)
{
isShowingAverage = false;
ShowDetail();
showText.text = "Tampilkan Rata-Rata";
}
else {
isShowingAverage = true;
ShowAverage();
showText.text = "Tampilkan Detail";
}
}
private void ShowAverage()
{
foreach (Transform t in parent)
{
Destroy(t.gameObject);
}
List<Answer> answers = GameManager.Instance.GetAnswers();
AverageDataDisplay Protan = Instantiate(averageDataDisplayPrefab, parent);
Protan.SetData(answers, Level.Protan);
AverageDataDisplay Deutan = Instantiate(averageDataDisplayPrefab, parent);
Deutan.SetData(answers, Level.Deutan);
AverageDataDisplay Tritan = Instantiate(averageDataDisplayPrefab, parent);
Tritan.SetData(answers, Level.Tritan);
}
private void ShowDetail()
{
foreach (Transform t in parent)
{
Destroy(t.gameObject);
}
List<Answer> answers = GameManager.Instance.GetAnswers();
for (int i = 0; i < answers.Count; i++)
{
DetailDataDisplay p = Instantiate(detailDataDisplayPrefab, parent);
p.SetData(answers[i]);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 234d71201bdfd03479285497530226b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIManager : MonoBehaviour
{
[SerializeField] private Canvas canvas;
public virtual void Show()
{
canvas.enabled = true;
}
public virtual void Hide()
{
canvas.enabled = false;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f946136b507d30f44a44263cafd89a33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: