ButtonsMemoryMinigame #28
@@ -463,6 +463,59 @@ Transform:
|
||||
- {fileID: 856787240}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &735031180
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 735031182}
|
||||
- component: {fileID: 735031181}
|
||||
m_Layer: 0
|
||||
m_Name: ButtonsMinigameManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &735031181
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 735031180}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8f3e0b0291a66dd4f8e11122ae23813e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::MinigameManager
|
||||
lights:
|
||||
- {fileID: 31013496}
|
||||
- {fileID: 314377408}
|
||||
- {fileID: 938605854}
|
||||
- {fileID: 1004318827}
|
||||
- {fileID: 2010856784}
|
||||
round: 5
|
||||
glowDuration: 2
|
||||
gapBetween: 1
|
||||
--- !u!4 &735031182
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 735031180}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.15409, y: 0.94281, z: 7.52282}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &808244613
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1486,3 +1539,4 @@ SceneRoots:
|
||||
- {fileID: 808244616}
|
||||
- {fileID: 1514307111}
|
||||
- {fileID: 721416389}
|
||||
- {fileID: 735031182}
|
||||
|
||||
41
Assets/Scripts/ButtonsMinigame.cs
Normal file
41
Assets/Scripts/ButtonsMinigame.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ButtonsMinigame : MonoBehaviour
|
||||
{
|
||||
public Light[] lights;
|
||||
public int round = 1;
|
||||
public float glowDuration = 0.4f;
|
||||
public float gapBetween = 0.15f;
|
||||
private List<int> sequence = new List<int>();
|
||||
|
||||
void Generatesequence()
|
||||
{
|
||||
sequence.Clear();
|
||||
for (int i = 0; i < round; i++)
|
||||
{
|
||||
int randomButton = Random.Range(0,5);
|
||||
sequence.Add(randomButton);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Playsequence()
|
||||
{
|
||||
for (int i = 0; i < sequence.Count; i++)
|
||||
{
|
||||
int buttonIndex = sequence[i];
|
||||
lights[buttonIndex].gameObject.SetActive(true);
|
||||
yield return new WaitForSeconds (glowDuration);
|
||||
lights[buttonIndex].gameObject.SetActive(false);
|
||||
yield return new WaitForSeconds (gapBetween);
|
||||
}
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
Generatesequence();
|
||||
StartCoroutine(Playsequence());
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/ButtonsMinigame.cs.meta
Normal file
2
Assets/Scripts/ButtonsMinigame.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f3e0b0291a66dd4f8e11122ae23813e
|
||||
Reference in New Issue
Block a user