Cornクラスから飛び出し演出処理を削除

This commit is contained in:
kimura 2021-07-13 09:23:40 +09:00
parent 0123184c34
commit b2dbea36b2
2 changed files with 5 additions and 40 deletions

View File

@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 7195010600253370228}
- component: {fileID: 8932234855615206969}
m_Layer: 0
m_Name: Corn
m_Name: corn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -74,8 +74,6 @@ MonoBehaviour:
effectBurnt: {fileID: 3984349228049242719, guid: 02298b5aac4434a4c81aec58ad2caa9d,
type: 3}
animator: {fileID: 5972257590091015193}
spilledCornAnimationPrefab: {fileID: 2449901118440757730, guid: 7e7fbf241bd7f461fb46363ff0c6be3e,
type: 3}
--- !u!50 &7195010600253370228
Rigidbody2D:
serializedVersion: 4

View File

@ -27,7 +27,6 @@ public class Corn : MonoBehaviour
[SerializeField] private Sprite cornBurntSprite;
[SerializeField] private GameObject effectBurnt;
[SerializeField] private Animator animator;
[SerializeField] private GameObject spilledCornAnimationPrefab;
private Rigidbody2D rigidbody;
private float cornPopTime;
@ -37,8 +36,6 @@ public class Corn : MonoBehaviour
private float cornSpillSpeed;
private float cornPopSpeed;
private float worldWidth;
public IReadOnlyReactiveProperty<CornCondition> Condition => condition;
private readonly ReactiveProperty<CornCondition> condition = new ReactiveProperty<CornCondition>(CornCondition.Seed);
@ -56,8 +53,6 @@ public class Corn : MonoBehaviour
spriteTransform = spriteRenderer.transform;
rotationResolverTransform = spriteTransform.parent.parent;
var rightTop = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));
worldWidth = rightTop.x;
animator.SetFloat(HashWaitOffset, Random.value/2);
}
@ -142,39 +137,11 @@ public class Corn : MonoBehaviour
GetComponent<Collider2D>().enabled = false;
// フライパンに追従しないようにparent解除
transform.parent = null;
switch (prevCondition)
this.CallWaitForSeconds(.5f, () => Destroy(gameObject));
if (prevCondition == CornCondition.Seed)
{
case CornCondition.Seed:
VibrationManager.Instance.PlayVibrationOnce();
Observable.Timer(TimeSpan.FromSeconds(.5f)).Subscribe(_ =>
{
Destroy(gameObject);
}).AddTo(this);
break;
case CornCondition.Simple:
case CornCondition.Burnt:
Observable.Timer(TimeSpan.FromSeconds(Random.Range(.3f, .5f))).Subscribe(_ =>
{
Destroy(gameObject);
// 画面KO再生同時飛び出し時ランダム
var animation = Instantiate(spilledCornAnimationPrefab, new Vector2(Random.value * worldWidth * 2 - worldWidth, Random.value * 2 * 2 - 2), Quaternion.identity);
// KOコーンスキン変更
animation.GetComponent<CornSpilled>().ChangeCornSkin(prevCondition);
VibrationManager.Instance.PlayVibrationOnce();
Observable.Timer(TimeSpan.FromSeconds(1.5f)).Subscribe(__ =>
{
Destroy(animation);
});
}).AddTo(this);
break;
case CornCondition.Spilled:
break;
default:
throw new ArgumentOutOfRangeException(nameof(prevCondition), prevCondition, null);
}
}
public void SetCornProperty(float popTime, float burntDuration, float spillSpeed, float popSpeed)