転んだときのアイテム獲得判定を無効
This commit is contained in:
parent
0de81be22e
commit
d152b81aec
|
|
@ -256,9 +256,15 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
}
|
||||
#endif
|
||||
x.enabled = false;
|
||||
|
||||
if (player.IsHit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (item.ItemType)
|
||||
{
|
||||
case StageItem.Type.Item1:
|
||||
item.Effect();
|
||||
scoreCount.Value += item.Point;
|
||||
player.AddCount();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
[SerializeField] private GameObject level3;
|
||||
private Animator animator;
|
||||
private bool isJump;
|
||||
private bool isPreHit;
|
||||
private readonly BoolReactiveProperty isHit = new BoolReactiveProperty();
|
||||
private bool isHit;
|
||||
public bool IsHit => isHit;
|
||||
private readonly BoolReactiveProperty isHitStay = new BoolReactiveProperty();
|
||||
private IDisposable hitDisposable;
|
||||
private Coroutine jumpCoroutine;
|
||||
private Vector3 basePos;
|
||||
|
|
@ -27,14 +28,14 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
|
||||
private void Start()
|
||||
{
|
||||
isHit.AddTo(this);
|
||||
isHitStay.AddTo(this);
|
||||
animator = GetComponent<Animator>();
|
||||
basePos = transform.localPosition;
|
||||
}
|
||||
|
||||
public void Stay(bool force = false)
|
||||
{
|
||||
if (!force && isPreHit)
|
||||
if (!force && isHit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,12 +44,12 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
|
||||
public void Move()
|
||||
{
|
||||
if (isHit.Value)
|
||||
if (isHitStay.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
transform.AddPositionX(speed * Time.deltaTime);
|
||||
if (isJump || isPreHit)
|
||||
if (isJump || isHit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -57,7 +58,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
|
||||
public void Jump()
|
||||
{
|
||||
if (isJump || isPreHit)
|
||||
if (isJump || isHit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -79,13 +80,13 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
// こける
|
||||
public void Hit()
|
||||
{
|
||||
if (isPreHit)
|
||||
if (isHit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SoundManager.Instance.PlaySE("se_minigame_Collide");
|
||||
animator?.Play("Brother_pink_FallDown");
|
||||
isPreHit = true;
|
||||
isHit = true;
|
||||
hitDisposable?.Dispose();
|
||||
|
||||
this.SafeStopCoroutine(jumpCoroutine);
|
||||
|
|
@ -101,11 +102,11 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
{
|
||||
}, () =>
|
||||
{
|
||||
isHit.Value = true;
|
||||
isHitStay.Value = true;
|
||||
this.CallWaitForSeconds(hitWaitTime, () =>
|
||||
{
|
||||
isPreHit = false;
|
||||
isHit.Value = false;
|
||||
isHit = false;
|
||||
isHitStay.Value = false;
|
||||
Stay();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,10 +20,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
|
||||
public int Point => point;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
this.OnTriggerEnter2DAsObservable()
|
||||
.Subscribe(_ =>
|
||||
public void Effect()
|
||||
{
|
||||
// effect
|
||||
switch (itemType)
|
||||
|
|
@ -37,7 +34,6 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
public void ResetItem()
|
||||
|
|
|
|||
Loading…
Reference in New Issue