畑チュートリアル追加

This commit is contained in:
kimura 2021-10-26 12:34:24 +09:00
parent be61ac5532
commit fa100b99e8
2 changed files with 267 additions and 56 deletions

View File

@ -1793,7 +1793,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 134.89282, y: 302.00003}
m_AnchoredPosition: {x: 134.89258, y: 302}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &525465089
@ -2288,6 +2288,7 @@ MonoBehaviour:
- {fileID: 1656378502}
- {fileID: 1192216301}
- {fileID: 556316131}
cornFieldMask: {fileID: 971086866}
--- !u!4 &715847676
Transform:
m_ObjectHideFlags: 0
@ -2640,6 +2641,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 42}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &971086866 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5131953687285211373, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
m_PrefabInstance: {fileID: 2074297239}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4a8efaaa187d4865a1b4cabfa40ab6e9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &973728754
GameObject:
m_ObjectHideFlags: 0
@ -2759,7 +2772,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 134.89282, y: 91}
m_AnchoredPosition: {x: 134.89258, y: 91}
m_SizeDelta: {x: 300, y: 202}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &974444276
@ -14667,6 +14680,150 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1001 &2074297239
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 387414334}
m_Modifications:
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_RootOrder
value: 12
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820480, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820543, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_Name
value: TutorialObjectMask
objectReference: {fileID: 0}
- target: {fileID: 4293843006989820543, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4293843007976718249, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_SizeDelta.x
value: 1130.8464
objectReference: {fileID: 0}
- target: {fileID: 4293843007976718249, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_SizeDelta.y
value: 806.6114
objectReference: {fileID: 0}
- target: {fileID: 4293843007976718249, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 11.8
objectReference: {fileID: 0}
- target: {fileID: 4293843007976718249, guid: 1c993e9707f1a4fada56020be27dde28,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 173.4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1c993e9707f1a4fada56020be27dde28, type: 3}
--- !u!1 &2124911062 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2041305253, guid: caaa748dbeed576499e8cae74d33f689,

View File

@ -36,6 +36,8 @@ public class CornField : MonoBehaviour
[SerializeField] private Transform animationTarget;
[Space]
[SerializeField] private List<PlantLine> plantLines = new List<PlantLine>();
[Space] [SerializeField] private TutorialObjectMask cornFieldMask;
private static readonly int maxPeriod = 60;
private static readonly int minPeriod = 45;
private static readonly int harvestedFrameInterval = 3;
@ -61,6 +63,21 @@ public class CornField : MonoBehaviour
SoundManager.Instance.PlayBGM("bgm_Main");
// データ
var gameData = GameDataManager.GameData;
if (gameData.isFirstPlay)
{
promoteGrowthButton.gameObject.SetActive(false);
TutorialManager.Instance.ShowTutorialConversation(3, () =>
{
// コーンスワイプ指示
cornFieldMask.gameObject.SetActive(true);
});
}
else
{
cornFieldMask.gameObject.SetActive(false);
}
CoinManager.Instance.ChangeCoin(gameData.Coin);
HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart);
GameDataObserver.Instance.ShopLevelUpdate
@ -227,9 +244,10 @@ public class CornField : MonoBehaviour
// コーン株の進行度初回データ作成
foreach (var lineData in gameData.PlantLineDataList)
{
// コーン株の進行度初回データ作成
if (!gameData.SeedlingDataList.Exists(data => data.type == lineData.Type))
if (gameData.SeedlingDataList.Exists(data => data.type == lineData.Type))
{
continue;
}
var plantLine = plantLines.First(line => line.LineName == lineData.Type);
gameData.SeedlingDataList.Add(new SeedlingProgressData
{
@ -237,6 +255,34 @@ public class CornField : MonoBehaviour
Seedlings = Enumerable.Range(0, plantLine.Seedlings.Count).Select(_ => GenerateSeedlingGene(lineData.Level)).ToList()
});
}
if (gameData.isFirstPlay)
{
// 既に収穫できる状態にする
var plantLine = gameData.SeedlingDataList.First(data => data.type == PlantLineType.Center);
foreach (var seedling in plantLine.Seedlings)
{
seedling.FirstTime = DateTime.MinValue;
}
Observable.Merge(plantLines.SelectMany(line => line.Seedlings).Select(seedling => seedling.Harvested))
.Take(3)
.Subscribe(_ => { }, () =>
{
this.CallWaitForSeconds(4f, () =>
{
cornFieldMask.gameObject.SetActive(false);
TutorialManager.Instance.ShowTutorialConversation(4, () =>
{
// gameData.SeedlingDataList.Clear();
var go = FindObjectOfType<FooterManager>().transform;
go.transform.FindChildByName("Button_Purchasing", t =>
{
TutorialManager.Instance.ShowTutorialMask(go.parent, t as RectTransform);
});
});
});
}).AddTo(compositeDisposable);
}
GameDataManager.SaveGameData();
@ -244,8 +290,10 @@ public class CornField : MonoBehaviour
// セーブデータから畑を復元
foreach (var plantLine in plantLines)
{
if (gameData.PlantLineDataList.FirstOrDefault(data => data.Type == plantLine.LineName) is PlantLineData plantLineData)
if (!(gameData.PlantLineDataList.FirstOrDefault(data => data.Type == plantLine.LineName) is PlantLineData plantLineData))
{
continue;
}
plantLine.gameObject.SetActive(true);
plantLine.SetFieldLevel(plantLineData.Level);
@ -296,6 +344,7 @@ public class CornField : MonoBehaviour
});
});
}
// 新しい苗
var newGene = GenerateSeedlingGene(plantLineData.Level);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
@ -313,8 +362,13 @@ public class CornField : MonoBehaviour
progressData.Period = newGene.Period;
progressData.FirstTime = newGene.FirstTime;
GameDataManager.SaveGameData();
}).AddTo(compositeDisposable);
// チュートリアル時新しい苗を隠す
if (gameData.isFirstPlay)
{
seedling.SetSeedlingGene(DateTime.MaxValue, Int32.MaxValue, newGene.Level);
}
}).AddTo(compositeDisposable);
}
}