Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop
This commit is contained in:
commit
d324ce7723
|
|
@ -62,7 +62,7 @@ public class CornManager : MonoBehaviour
|
||||||
cornArray[i] = corn;
|
cornArray[i] = corn;
|
||||||
corn.SetCornProperty(baseCornPopTime, cornBurntDuration);
|
corn.SetCornProperty(baseCornPopTime, cornBurntDuration);
|
||||||
|
|
||||||
cornGrowSpeed.Where(_ => !isCompleted).Subscribe(x =>
|
cornGrowSpeed.TakeWhile(_ => !isCompleted).Subscribe(x =>
|
||||||
{
|
{
|
||||||
// コーンが弾けた後はRedの場合のみ焦げ進行する
|
// コーンが弾けた後はRedの場合のみ焦げ進行する
|
||||||
if (corn.Condition.Value == CornCondition.Simple && !isHot)
|
if (corn.Condition.Value == CornCondition.Simple && !isHot)
|
||||||
|
|
@ -93,8 +93,8 @@ public class CornManager : MonoBehaviour
|
||||||
.FirstOrDefault(x => !x.Contains(CornCondition.Seed))
|
.FirstOrDefault(x => !x.Contains(CornCondition.Seed))
|
||||||
.Subscribe(x =>
|
.Subscribe(x =>
|
||||||
{
|
{
|
||||||
isCompleted = true;
|
|
||||||
cornGrowSpeed.Value = 0f;
|
cornGrowSpeed.Value = 0f;
|
||||||
|
isCompleted = true;
|
||||||
if (x.Count(c => c == CornCondition.Simple) == x.Count) // すべてのコーンがPopped
|
if (x.Count(c => c == CornCondition.Simple) == x.Count) // すべてのコーンがPopped
|
||||||
{
|
{
|
||||||
result.SetValueAndForceNotify(CornResult.Perfect);
|
result.SetValueAndForceNotify(CornResult.Perfect);
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,15 @@ public class Pan : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private PanController controller;
|
[SerializeField] private PanController controller;
|
||||||
[SerializeField] private float thrust;
|
[SerializeField] private float thrust;
|
||||||
|
private static readonly float deadZone = 0.1f;
|
||||||
|
|
||||||
private void OnTriggerStay2D(Collider2D other)
|
private void OnTriggerStay2D(Collider2D other)
|
||||||
{
|
{
|
||||||
// Debug.Log(controller.Direction);
|
|
||||||
// 移動量が少ないときは動かない
|
// 移動量が少ないときは動かない
|
||||||
// if (controller.Delta.magnitude >= 1f) Debug.Log(controller.Delta.magnitude);
|
if (controller.Delta.magnitude < deadZone)
|
||||||
var direct = 1f;
|
{
|
||||||
direct = controller.Delta.magnitude < 0.1f ? 0 : 1;
|
return;
|
||||||
other.attachedRigidbody.AddForce(controller.Delta * thrust * direct, ForceMode2D.Impulse);
|
}
|
||||||
|
other.attachedRigidbody.AddForce(controller.Delta * thrust, ForceMode2D.Impulse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -18,13 +18,17 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||||
private Vector2 delta;
|
private Vector2 delta;
|
||||||
public Vector2 Delta => delta;
|
public Vector2 Delta => delta;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
void Awake()
|
||||||
void Start()
|
|
||||||
{
|
{
|
||||||
firstPos = target.position;
|
firstPos = target.position;
|
||||||
prevPos = firstPos;
|
prevPos = firstPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
delta = Vector2.zero;
|
||||||
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
@ -34,6 +38,9 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||||
delta = Vector2.zero;
|
delta = Vector2.zero;
|
||||||
}
|
}
|
||||||
prevPos = target.position;
|
prevPos = target.position;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
deltaString = $"delta: {delta.normalized} {delta.magnitude:F3}";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,9 +52,6 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||||
// 移動範囲を制限
|
// 移動範囲を制限
|
||||||
pos = targetBorder.bounds.ClosestPoint(pos);
|
pos = targetBorder.bounds.ClosestPoint(pos);
|
||||||
delta = pos - targetPos;
|
delta = pos - targetPos;
|
||||||
#if UNITY_EDITOR
|
|
||||||
deltaString = $"delta: {delta.normalized} {delta.magnitude:F3}";
|
|
||||||
#endif
|
|
||||||
target.position = pos;
|
target.position = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,4 +62,9 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||||
offset = targetPos - Camera.main.ScreenToWorldPoint(new Vector3(eventData.position.x, eventData.position.y,
|
offset = targetPos - Camera.main.ScreenToWorldPoint(new Vector3(eventData.position.x, eventData.position.y,
|
||||||
targetPos.z));
|
targetPos.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetTargetPosition()
|
||||||
|
{
|
||||||
|
target.position = firstPos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,15 +93,18 @@ public class ThermalControl : MonoBehaviour
|
||||||
temperature = 0f;
|
temperature = 0f;
|
||||||
temperatureSpeed = 0f;
|
temperatureSpeed = 0f;
|
||||||
thermoMeter.SetScale(coldValue, hotValue);
|
thermoMeter.SetScale(coldValue, hotValue);
|
||||||
|
panController.ResetTargetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartMeter()
|
public void StartMeter()
|
||||||
{
|
{
|
||||||
isMove = true;
|
isMove = true;
|
||||||
|
panController.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopMeter()
|
public void StopMeter()
|
||||||
{
|
{
|
||||||
isMove = false;
|
isMove = false;
|
||||||
|
panController.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue