Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop

This commit is contained in:
koya_15 2021-07-26 15:16:12 +09:00
commit 247c9f549a
13 changed files with 295 additions and 108 deletions

View File

@ -25,14 +25,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5078088515886692167} m_GameObject: {fileID: 5078088515886692167}
m_LocalRotation: {x: -0, y: -0, z: 0.42941898, w: 0.90310544} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.66, y: 2.9, z: 0} m_LocalPosition: {x: 2.66, y: 2.9, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 5078088516399480976} - {fileID: 5078088516399480976}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &5078088515886692165 --- !u!198 &5078088515886692165
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -116,7 +116,7 @@ ParticleSystem:
startLifetime: startLifetime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0.1 scalar: 0.15
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -4789,7 +4789,7 @@ ParticleSystemRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 5
m_RenderMode: 0 m_RenderMode: 0
m_SortMode: 0 m_SortMode: 0
m_MinParticleSize: 0 m_MinParticleSize: 0
@ -4838,13 +4838,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5078088516399480977} m_GameObject: {fileID: 5078088516399480977}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0.18903114, w: 0.98197114}
m_LocalPosition: {x: 0.24, y: 0.2, z: 0} m_LocalPosition: {x: 0.24, y: 0.2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 5078088515886692164} m_Father: {fileID: 5078088515886692164}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 50.861004} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -21.792002}
--- !u!198 &5078088516399480982 --- !u!198 &5078088516399480982
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5479,7 +5479,7 @@ ParticleSystem:
radiusThickness: 1 radiusThickness: 1
donutRadius: 0.2 donutRadius: 0.2
m_Position: {x: 0, y: 0, z: 0} m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0} m_Rotation: {x: 0, y: 0, z: 50}
m_Scale: {x: 1, y: 1, z: 1} m_Scale: {x: 1, y: 1, z: 1}
placementMode: 0 placementMode: 0
m_MeshMaterialIndex: 0 m_MeshMaterialIndex: 0
@ -5616,7 +5616,7 @@ ParticleSystem:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
arc: arc:
value: 76.8 value: 124.92
mode: 0 mode: 0
spread: 0 spread: 0
speed: speed:

View File

@ -25,13 +25,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4783546067082268242} m_GameObject: {fileID: 4783546067082268242}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0.21810172, w: 0.97592604}
m_LocalPosition: {x: 0.24, y: 0.2, z: 0} m_LocalPosition: {x: 0.24, y: 0.2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4783546067326661872} m_Father: {fileID: 4783546067326661872}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 50.861004} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -25.195002}
--- !u!198 &4783546067082268245 --- !u!198 &4783546067082268245
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -666,7 +666,7 @@ ParticleSystem:
radiusThickness: 1 radiusThickness: 1
donutRadius: 0.2 donutRadius: 0.2
m_Position: {x: 0, y: 0, z: 0} m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0} m_Rotation: {x: 0, y: 0, z: 50}
m_Scale: {x: 1, y: 1, z: 1} m_Scale: {x: 1, y: 1, z: 1}
placementMode: 0 placementMode: 0
m_MeshMaterialIndex: 0 m_MeshMaterialIndex: 0
@ -803,7 +803,7 @@ ParticleSystem:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
arc: arc:
value: 76.8 value: 127.3
mode: 0 mode: 0
spread: 0 spread: 0
speed: speed:
@ -4837,14 +4837,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4783546067326661837} m_GameObject: {fileID: 4783546067326661837}
m_LocalRotation: {x: -0, y: -0, z: 0.42941898, w: 0.90310544} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.66, y: 2.9, z: 0} m_LocalPosition: {x: 2.66, y: 2.9, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 4783546067082268243} - {fileID: 4783546067082268243}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &4783546067326661839 --- !u!198 &4783546067326661839
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4928,7 +4928,7 @@ ParticleSystem:
startLifetime: startLifetime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0.1 scalar: 0.15
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -9601,7 +9601,7 @@ ParticleSystemRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 5
m_RenderMode: 0 m_RenderMode: 0
m_SortMode: 0 m_SortMode: 0
m_MinParticleSize: 0 m_MinParticleSize: 0

View File

@ -9680,6 +9680,7 @@ GameObject:
- component: {fileID: 7516975307168929495} - component: {fileID: 7516975307168929495}
- component: {fileID: 7516975307168929494} - component: {fileID: 7516975307168929494}
- component: {fileID: 7516975307168929493} - component: {fileID: 7516975307168929493}
- component: {fileID: 721213865261247925}
m_Layer: 0 m_Layer: 0
m_Name: pt_Popcorn_strike m_Name: pt_Popcorn_strike
m_TagString: Untagged m_TagString: Untagged
@ -9694,14 +9695,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7516975307168929492} m_GameObject: {fileID: 7516975307168929492}
m_LocalRotation: {x: -0, y: -0, z: 0.42941898, w: 0.90310544} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.66, y: 2.9, z: 0} m_LocalPosition: {x: 2.66, y: 2.9, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 7516975307813098670} - {fileID: 7516975307813098670}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &7516975307168929494 --- !u!198 &7516975307168929494
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -9785,7 +9786,7 @@ ParticleSystem:
startLifetime: startLifetime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0.1 scalar: 0.15
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -14458,7 +14459,7 @@ ParticleSystemRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 5
m_RenderMode: 0 m_RenderMode: 0
m_SortMode: 0 m_SortMode: 0
m_MinParticleSize: 0 m_MinParticleSize: 0
@ -14482,6 +14483,24 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0} m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0} m_Mesh3: {fileID: 0}
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!114 &721213865261247925
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7516975307168929492}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0125090276d945c2bb856fd440fdff6b, type: 3}
m_Name:
m_EditorClassIdentifier:
particleRenderA: {fileID: 7516975307813098671}
particleRenderB: {fileID: 7516975307116267766}
particleRenderC: {fileID: 7516975306867202139}
burntMaterialA: {fileID: 2100000, guid: bec51957e6eb5467abd3d46dc72f642a, type: 2}
burntMaterialB: {fileID: 2100000, guid: cea7e196dbc8d4a4a8b8540ce7a2410f, type: 2}
burntMaterialC: {fileID: 2100000, guid: 036c01b6cfb3f425e9b48f183b100571, type: 2}
--- !u!1 &7516975307813098669 --- !u!1 &7516975307813098669
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -15151,7 +15170,7 @@ ParticleSystem:
radiusThickness: 0 radiusThickness: 0
donutRadius: 0.2 donutRadius: 0.2
m_Position: {x: 0, y: 0, z: 0} m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0} m_Rotation: {x: 0, y: 0, z: 50}
m_Scale: {x: 1, y: 1, z: 1} m_Scale: {x: 1, y: 1, z: 1}
placementMode: 0 placementMode: 0
m_MeshMaterialIndex: 0 m_MeshMaterialIndex: 0

View File

@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: popcorn_unfinished_burnt_failure_Dither
m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8d287beb744ac6b458a3088ac499a1dd, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

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

View File

@ -8912,12 +8912,8 @@ MonoBehaviour:
cornSpawnTarget: {fileID: 1440136003} cornSpawnTarget: {fileID: 1440136003}
cornPrefab: {fileID: 5499754490129207122, guid: 2b790fd908bd14de4a601c21374fb55b, cornPrefab: {fileID: 5499754490129207122, guid: 2b790fd908bd14de4a601c21374fb55b,
type: 3} type: 3}
spilledCornAnimationPrefab: {fileID: 2449901118440757730, guid: 7e7fbf241bd7f461fb46363ff0c6be3e, spilledCornAnimationPrefab: {fileID: 7516975307168929492, guid: 33c91c454a38e410cb291f1f2e5756cc,
type: 3} type: 3}
missCornAnimationPrefab: {fileID: 4156092651619109751, guid: 59ad9ca2628fc4f9d8f03900854207ac,
type: 3}
cornMissMeter: {fileID: 1871878300}
missTextSpawnTransform: {fileID: 676036207}
cornSpawnCount: 50 cornSpawnCount: 50
maxFailedCornCount: 25 maxFailedCornCount: 25
baseGrowSpeed: 1 baseGrowSpeed: 1
@ -8943,18 +8939,6 @@ RectTransform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 8509883328564265099} m_PrefabInstance: {fileID: 8509883328564265099}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &1871878300 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4080947763864399562, guid: 1a47fa9bdeb434bffa410f731816203f,
type: 3}
m_PrefabInstance: {fileID: 8509883328564265099}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2537d840e3a243a1883f1c5289412fd9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1928679189 --- !u!1 &1928679189
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -70,6 +70,11 @@ MonoBehaviour:
cornSkin: {fileID: 7130900939474693981} cornSkin: {fileID: 7130900939474693981}
effectBurnt: {fileID: 3984349228049242719, guid: 02298b5aac4434a4c81aec58ad2caa9d, effectBurnt: {fileID: 3984349228049242719, guid: 02298b5aac4434a4c81aec58ad2caa9d,
type: 3} type: 3}
effectSpillSeed: {fileID: 5078088515886692167, guid: 6e11516cabfc8450593dee19282ddd0d,
type: 3}
effectSpillPopped: {fileID: 4783546067326661837, guid: b66901098e7af4bd483c1dda2a423941,
type: 3}
burntMaterial: {fileID: 2100000, guid: bec51957e6eb5467abd3d46dc72f642a, type: 2}
animator: {fileID: 5972257590091015193} animator: {fileID: 5972257590091015193}
--- !u!50 &7195010600253370228 --- !u!50 &7195010600253370228
Rigidbody2D: Rigidbody2D:
@ -84,7 +89,7 @@ Rigidbody2D:
m_UseFullKinematicContacts: 0 m_UseFullKinematicContacts: 0
m_UseAutoMass: 0 m_UseAutoMass: 0
m_Mass: 1 m_Mass: 1
m_LinearDrag: 3 m_LinearDrag: 3.5
m_AngularDrag: 2 m_AngularDrag: 2
m_GravityScale: 0 m_GravityScale: 0
m_Material: {fileID: 6200000, guid: 1e68e56cd6ac4484ba25eb760e0d3057, type: 2} m_Material: {fileID: 6200000, guid: 1e68e56cd6ac4484ba25eb760e0d3057, type: 2}

View File

@ -22,6 +22,9 @@ public class Corn : MonoBehaviour
[SerializeField] private CornSkin cornSkin; [SerializeField] private CornSkin cornSkin;
[SerializeField] private GameObject effectBurnt; [SerializeField] private GameObject effectBurnt;
[SerializeField] private GameObject effectSpillSeed;
[SerializeField] private GameObject effectSpillPopped;
[SerializeField] private Material burntMaterial;
[SerializeField] private Animator animator; [SerializeField] private Animator animator;
private Rigidbody2D rigidbody; private Rigidbody2D rigidbody;
@ -63,17 +66,26 @@ public class Corn : MonoBehaviour
this.ObserveEveryValueChanged(x => x.rigidbody.velocity.magnitude) this.ObserveEveryValueChanged(x => x.rigidbody.velocity.magnitude)
.Where(x => x >= cornSpillSpeed) .Where(x => x >= cornSpillSpeed)
.ThrottleFirstFrame(30) // 30フレーム間隔開ける .ThrottleFirstFrame(30) // 30フレーム間隔開ける
.Select(_ => Random.value < .2f) // 演出を出す確率 .Where(_ => Random.value < .2f) // 演出を出す確率
.FirstOrDefault() .FirstOrDefault()
.Subscribe(_ => .Subscribe(_ =>
{ {
spilled.Value = true; spilled.Value = true;
var clone = Instantiate(cornSkin); GameObject effect;
clone.ChangeSkin(condition.Value); if (condition.Value == CornCondition.Seed)
var cloneRigidBody = clone.gameObject.AddComponent<Rigidbody2D>(); {
cloneRigidBody.gravityScale = 0; effect = Instantiate(effectSpillSeed, transform.position, Quaternion.identity, null);
cloneRigidBody.AddForce(rigidbody.velocity.normalized * 20f, ForceMode2D.Impulse); this.CallWaitForSeconds(5f, () => Destroy(effect));
this.CallWaitForSeconds(2f, () => Destroy(clone.gameObject)); }
else
{
effect = Instantiate(effectSpillPopped, transform.position, Quaternion.identity, null);
if (condition.Value == CornCondition.Burnt)
{
effect.transform.GetChild(0).GetComponentInChildren<ParticleSystemRenderer>().material = burntMaterial;
}
this.CallWaitForSeconds(5f, () => Destroy(effect));
}
}).AddTo(this); }).AddTo(this);
condition.Pairwise().Subscribe(x => condition.Pairwise().Subscribe(x =>

View File

@ -18,11 +18,6 @@ public class CornManager : MonoBehaviour
[SerializeField] private Transform cornSpawnTarget; [SerializeField] private Transform cornSpawnTarget;
[SerializeField] private Corn cornPrefab; [SerializeField] private Corn cornPrefab;
[SerializeField] private GameObject spilledCornAnimationPrefab; [SerializeField] private GameObject spilledCornAnimationPrefab;
[SerializeField] private GameObject missCornAnimationPrefab;
[SerializeField] private CornMissMeter cornMissMeter;
[SerializeField] private RectTransform missTextSpawnTransform;
private static readonly Bounds missEffectBounds = new Bounds(new Vector3(0f, 1.7f), new Vector3(10f, 7f));
[SerializeField] private int cornSpawnCount = 20; [SerializeField] private int cornSpawnCount = 20;
[SerializeField] private int maxFailedCornCount = 10; [SerializeField] private int maxFailedCornCount = 10;
[SerializeField, ReadOnly] private float baseGrowSpeed = 1f; [SerializeField, ReadOnly] private float baseGrowSpeed = 1f;
@ -37,14 +32,11 @@ public class CornManager : MonoBehaviour
public IReadOnlyReactiveProperty<CornResult> Result => result; public IReadOnlyReactiveProperty<CornResult> Result => result;
private readonly ReactiveProperty<CornResult> result = new ReactiveProperty<CornResult>(); private readonly ReactiveProperty<CornResult> result = new ReactiveProperty<CornResult>();
private float worldWidth;
private float worldHeight;
private static readonly float maxSpilledHeight = 4f;
private Corn[] cornArray; private Corn[] cornArray;
private bool isHot; private bool isHot;
private bool isCompleted; private bool isCompleted;
private readonly List<IObservable<CornCondition>> cornConditions = new List<IObservable<CornCondition>>(); private readonly List<IObservable<CornCondition>> cornConditions = new List<IObservable<CornCondition>>();
private readonly Subject<CornCondition> cornSpilledSubject = new Subject<CornCondition>(); private readonly Subject<(CornCondition cond, Vector3 pos)> cornSpilledSubject = new Subject<(CornCondition, Vector3)>();
private readonly ReactiveProperty<int> missCount = new ReactiveProperty<int>(); private readonly ReactiveProperty<int> missCount = new ReactiveProperty<int>();
private readonly ReactiveProperty<float> cornGrowSpeed = new FloatReactiveProperty(0f); private readonly ReactiveProperty<float> cornGrowSpeed = new FloatReactiveProperty(0f);
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
@ -63,9 +55,6 @@ public class CornManager : MonoBehaviour
private void Awake() private void Awake()
{ {
var leftTop = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));
worldWidth = leftTop.x;
worldHeight = leftTop.y;
cornArray = new Corn[cornSpawnCount]; cornArray = new Corn[cornSpawnCount];
result.AddTo(this); result.AddTo(this);
cornGrowSpeed.AddTo(this); cornGrowSpeed.AddTo(this);
@ -77,13 +66,13 @@ public class CornManager : MonoBehaviour
// コーン飛び出し制御 // コーン飛び出し制御
// 5フレームごとに2回など演出の回数を制御 // 5フレームごとに2回など演出の回数を制御
cornSpilledSubject cornSpilledSubject
.Where(x => x != CornCondition.Seed) // Seedは演出なし .Where(x => x.cond != CornCondition.Seed) // Seedは演出なし
.BatchFrame(5, FrameCountType.EndOfFrame) // 指定フレーム分まとめる .BatchFrame(5, FrameCountType.EndOfFrame) // 指定フレーム分まとめる
.Subscribe(x => .Subscribe(x =>
{ {
foreach (var condition in x.RandomChoose(2)) foreach (var item in x.RandomChoose(2))
{ {
SpawnSpilledAnimation(condition); SpawnSpilledAnimation(item.cond, item.pos);
} }
}).AddTo(this); }).AddTo(this);
@ -124,7 +113,6 @@ public class CornManager : MonoBehaviour
{ {
cornGrowSpeed.Value = 0f; cornGrowSpeed.Value = 0f;
missCount.Value = 0; missCount.Value = 0;
cornMissMeter.ResetMeter();
isCompleted = false; isCompleted = false;
compositeDisposable.Clear(); compositeDisposable.Clear();
cornConditions.Clear(); cornConditions.Clear();
@ -138,26 +126,11 @@ public class CornManager : MonoBehaviour
cornArray = new Corn[cornSpawnCount]; cornArray = new Corn[cornSpawnCount];
// コーン生成 // コーン生成
var popTime = 1f;
for (int i = 0; i < cornSpawnCount; i++) for (int i = 0; i < cornSpawnCount; i++)
{ {
// コーン生成テーブル
if (1 <= i && i <= 5)
{
popTime += 3 - (i - 1) * .5f;
}
else if (6 <= i && i <= 10)
{
popTime += 0.5f - (i - 6) * .1f;
}
else if (11 <= i)
{
popTime += .1f;
}
var corn = Instantiate(cornPrefab, cornSpawnTarget); var corn = Instantiate(cornPrefab, cornSpawnTarget);
cornArray[i] = corn; cornArray[i] = corn;
corn.SetCornProperty(popTime, cornBurntDuration + Random.Range(0, cornBurntRandom), cornSpillSpeed, cornPopSpeed); corn.SetCornProperty( CornPopParameters.CornPopTimeArray[i], CornPopParameters.CornBurntTimeArray[i], cornSpillSpeed, cornPopSpeed);
// 進行速度の変更時、コーン速度変更 // 進行速度の変更時、コーン速度変更
cornGrowSpeed.TakeWhile(_ => !isCompleted).Subscribe(x => cornGrowSpeed.TakeWhile(_ => !isCompleted).Subscribe(x =>
{ {
@ -198,11 +171,7 @@ public class CornManager : MonoBehaviour
}).AddTo(compositeDisposable); }).AddTo(compositeDisposable);
corn.Spilled corn.Spilled
.Subscribe(_ => .Subscribe(_ => cornSpilledSubject.OnNext((corn.Condition.Value, corn.transform.position))).AddTo(compositeDisposable);
{
// 同時に飛び出したとき用に演出をばらつかせる
corn.CallWaitForSeconds(Random.Range(0f, .5f), () => cornSpilledSubject.OnNext(corn.Condition.Value));
}).AddTo(compositeDisposable);
cornConditions.Add(corn.Condition); cornConditions.Add(corn.Condition);
} }
@ -252,39 +221,16 @@ public class CornManager : MonoBehaviour
} }
} }
private void SpawnSpilledAnimation(CornCondition condition) private void SpawnSpilledAnimation(CornCondition condition, Vector3 position)
{ {
// Result表示より下の範囲にランダム表示
var position = new Vector2((Random.value * 2 - 1) * worldWidth, Mathf.Lerp(-worldHeight, maxSpilledHeight, Random.value));
// 画面KO再生 // 画面KO再生
var animation = Instantiate(spilledCornAnimationPrefab, position, Quaternion.identity); var animation = Instantiate(spilledCornAnimationPrefab, position, Quaternion.identity);
// KOコーンスキン変更 // KOコーンスキン変更
animation.GetComponent<CornSpilled>().ChangeCornSkin(condition); animation.GetComponent<PopcornStrikeEffect>().ChangeSkin(condition);
VibrationManager.Instance.PlayVibrationDoubleStrong(); VibrationManager.Instance.PlayVibrationDoubleStrong();
this.CallWaitForSeconds(1.5f, () => Destroy(animation)); this.CallWaitForSeconds(1.5f, () => Destroy(animation));
} }
private void SpawnMissAnimation(CornCondition condition)
{
// ミス表示
var position = new Vector2(Random.Range(missEffectBounds.min.x, missEffectBounds.max.x), Random.Range(missEffectBounds.min.y, missEffectBounds.max.y));
var animation = Instantiate(missCornAnimationPrefab, position, Quaternion.identity, missTextSpawnTransform);
animation.GetComponent<CornMissEffect>().ChangeSkin(condition);
this.CallWaitForSeconds(.75f, () =>
{
this.CallLerp(.2f, f =>
{
animation.transform.position = Vector3.Lerp(position, cornMissMeter.transform.position, f.EaseInCubic());
}, () =>
{
VibrationManager.Instance.PlayVibrationOnce();
cornMissMeter.SetMeter((float)missCount.Value/maxFailedCornCount);
Destroy(animation);
});
});
}
private void SetResult(CornResult resultValue) private void SetResult(CornResult resultValue)
{ {
cornGrowSpeed.Value = 0f; cornGrowSpeed.Value = 0f;

View File

@ -0,0 +1,108 @@
public class CornPopParameters
{
public static readonly float[] CornPopTimeArray = {
1f,
4f,
6.5f,
8.5f,
10f,
11f,
11.5f,
11.9f,
12.2f,
12.4f,
12.5f,
12.6f,
12.7f,
12.8f,
12.9f,
13f,
13.1f,
13.2f,
13.3f,
13.4f,
13.5f,
13.6f,
13.7f,
13.8f,
13.9f,
14f,
14.1f,
14.2f,
14.3f,
14.4f,
14.5f,
14.6f,
14.7f,
14.8f,
14.9f,
15f,
15.1f,
15.2f,
15.3f,
15.4f,
15.5f,
15.6f,
15.7f,
15.8f,
15.9f,
16f,
16.1f,
16.2f,
16.3f,
16.4f,
};
public static readonly float[] CornBurntTimeArray = {
7.6f,
6.085f,
4.82f,
3.805f,
3.04f,
2.525f,
2.26f,
2.045f,
1.88f,
1.765f,
1.7f,
1.635f,
1.57f,
1.505f,
1.44f,
1.375f,
1.31f,
1.245f,
1.18f,
1.115f,
1.05f,
0.985f,
0.92f,
0.855f,
0.8f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
1.5f,
};
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4a39eee460c642d5a761191849b7ff22
timeCreated: 1627272430

View File

@ -0,0 +1,22 @@
using System;
using UnityEngine;
public class PopcornStrikeEffect : MonoBehaviour
{
[SerializeField] private ParticleSystemRenderer particleRenderA;
[SerializeField] private ParticleSystemRenderer particleRenderB;
[SerializeField] private ParticleSystemRenderer particleRenderC;
[SerializeField] private Material burntMaterialA;
[SerializeField] private Material burntMaterialB;
[SerializeField] private Material burntMaterialC;
public void ChangeSkin(CornCondition condition)
{
if (condition == CornCondition.Burnt)
{
particleRenderA.material = burntMaterialA;
particleRenderB.material = burntMaterialB;
particleRenderC.material = burntMaterialC;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0125090276d945c2bb856fd440fdff6b
timeCreated: 1627263716