ゲームオーバー追加
This commit is contained in:
parent
078ac6eb77
commit
cf06a40c80
|
|
@ -202,6 +202,42 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &337575052
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 337575053}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: GameResult
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &337575053
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 337575052}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1003859322}
|
||||||
|
m_Father: {fileID: 676036207}
|
||||||
|
m_RootOrder: 3
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &420543913
|
--- !u!1 &420543913
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -398,6 +434,7 @@ RectTransform:
|
||||||
- {fileID: 8786490829663474095}
|
- {fileID: 8786490829663474095}
|
||||||
- {fileID: 8786490828878428803}
|
- {fileID: 8786490828878428803}
|
||||||
- {fileID: 8786490829224139746}
|
- {fileID: 8786490829224139746}
|
||||||
|
- {fileID: 337575053}
|
||||||
m_Father: {fileID: 420543917}
|
m_Father: {fileID: 420543917}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
@ -418,6 +455,84 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 3d5a5f132babc4b3e9790ccbeb891054, type: 3}
|
m_Script: {fileID: 11500000, guid: 3d5a5f132babc4b3e9790ccbeb891054, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &1003859321
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1003859322}
|
||||||
|
- component: {fileID: 1003859324}
|
||||||
|
- component: {fileID: 1003859323}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Text
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1003859322
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1003859321}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 337575053}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 429}
|
||||||
|
m_SizeDelta: {x: 1195.3561, y: 224.12926}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1003859323
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1003859321}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0.4056604, g: 0.4056604, b: 0.4056604, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 14
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_BestFit: 1
|
||||||
|
m_MinSize: 10
|
||||||
|
m_MaxSize: 189
|
||||||
|
m_Alignment: 4
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: "\u6210\u529F\uFF01"
|
||||||
|
--- !u!222 &1003859324
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1003859321}
|
||||||
|
m_CullTransparentMesh: 0
|
||||||
--- !u!1 &1129457737
|
--- !u!1 &1129457737
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -636,7 +751,8 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
startingGuide: {fileID: 8786490829224139677}
|
startingGuide: {fileID: 8786490829224139677}
|
||||||
powerMeter: {fileID: 8786490829663474092}
|
powerMeter: {fileID: 8786490829663474092}
|
||||||
powerResult: {fileID: 8786490830332208977}
|
powerResultText: {fileID: 8786490830332208977}
|
||||||
|
gameResultText: {fileID: 1003859323}
|
||||||
--- !u!4 &1870432534
|
--- !u!4 &1870432534
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,28 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class PopcornGameManager : MonoBehaviour
|
public class PopcornGameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private GameObject startingGuide;
|
[SerializeField] private GameObject startingGuide;
|
||||||
[SerializeField] private PowerMeter powerMeter;
|
[SerializeField] private PowerMeter powerMeter;
|
||||||
[SerializeField] private Text powerResult;
|
[SerializeField] private Text powerResultText;
|
||||||
|
[SerializeField] private Text gameResultText;
|
||||||
|
|
||||||
private Action tapAction;
|
private Action tapAction;
|
||||||
private bool isProgress;
|
private bool isProgress;
|
||||||
|
private int gameCount;
|
||||||
|
private int failCount;
|
||||||
|
private readonly int maxGameCount = 3;
|
||||||
|
private readonly int maxFailCount = 2;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
powerResult.text = "";
|
powerResultText.text = "";
|
||||||
|
gameResultText.text = "";
|
||||||
startingGuide.SetActive(true);
|
startingGuide.SetActive(true);
|
||||||
powerMeter.StopMove();
|
powerMeter.StopMove();
|
||||||
isProgress = false;
|
isProgress = false;
|
||||||
|
|
@ -31,38 +38,81 @@ public class PopcornGameManager : MonoBehaviour
|
||||||
|
|
||||||
private void GameStart()
|
private void GameStart()
|
||||||
{
|
{
|
||||||
|
gameCount = 0;
|
||||||
|
failCount = 0;
|
||||||
powerMeter.StartMove();
|
powerMeter.StartMove();
|
||||||
tapAction = () =>
|
tapAction = () =>
|
||||||
{
|
{
|
||||||
isProgress = true;
|
isProgress = true;
|
||||||
powerMeter.StopMove();
|
powerMeter.StopMove();
|
||||||
|
gameCount++;
|
||||||
var pos = powerMeter.GetCurrentPosisiton();
|
var pos = powerMeter.GetCurrentPosisiton();
|
||||||
Debug.Log($"tap! {pos}");
|
Debug.Log($"tap! {pos}");
|
||||||
// 判定
|
// 判定
|
||||||
CheckQuality(pos);
|
if (!CheckQuality(pos))
|
||||||
|
{
|
||||||
|
failCount++;
|
||||||
|
}
|
||||||
|
|
||||||
this.CallWaitForSeconds(1f, () =>
|
this.CallWaitForSeconds(1f, () =>
|
||||||
{
|
{
|
||||||
|
powerResultText.text = "";
|
||||||
|
// 失敗
|
||||||
|
if (failCount >= maxFailCount)
|
||||||
|
{
|
||||||
|
gameResultText.text = "失敗!";
|
||||||
|
powerMeter.gameObject.SetActive(false);
|
||||||
|
tapAction = () => { };
|
||||||
|
this.CallWaitForSeconds(1f, () =>
|
||||||
|
{
|
||||||
|
gameResultText.text = "タップでリスタート";
|
||||||
|
tapAction = () => {
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene("Main");
|
||||||
|
}};
|
||||||
|
isProgress = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成功
|
||||||
|
if (gameCount >= maxGameCount)
|
||||||
|
{
|
||||||
|
gameResultText.text = "成功!";
|
||||||
|
powerMeter.gameObject.SetActive(false);
|
||||||
|
tapAction = () => { };
|
||||||
|
this.CallWaitForSeconds(1f, () =>
|
||||||
|
{
|
||||||
|
gameResultText.text = "タップでリスタート";
|
||||||
|
tapAction = () => {
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene("Main");
|
||||||
|
}};
|
||||||
|
isProgress = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
isProgress = false;
|
isProgress = false;
|
||||||
powerResult.text = "";
|
|
||||||
powerMeter.StartMove();
|
powerMeter.StartMove();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckQuality(float pos)
|
private bool CheckQuality(float pos)
|
||||||
{
|
{
|
||||||
//Great=0.3
|
//Great=0.3
|
||||||
//Perfect=0.45~0.5
|
//Perfect=0.45~0.5
|
||||||
powerResult.text = "ミス!";
|
powerResultText.text = "ミス!";
|
||||||
if (pos <= 0.2)
|
if (pos <= 0.2)
|
||||||
{
|
{
|
||||||
powerResult.text = "グッド";
|
powerResultText.text = "グッド";
|
||||||
}
|
|
||||||
if (pos <= 0.05f)
|
if (pos <= 0.05f)
|
||||||
{
|
{
|
||||||
powerResult.text = "パーフェクト";
|
powerResultText.text = "パーフェクト";
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue