吹っ飛び追加
This commit is contained in:
parent
43b66bb0ca
commit
dbaa7d294a
|
|
@ -44,11 +44,23 @@ public class Corn : MonoBehaviour
|
||||||
rigidbody2D.position = new Vector2(Random.value, Random.value);
|
rigidbody2D.position = new Vector2(Random.value, Random.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float maxVelocity;
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
cornVelocity = rigidbody2D.velocity.magnitude;
|
cornVelocity = rigidbody2D.velocity.magnitude;
|
||||||
cornLifeTime = Time.time - cornSpawnTime;
|
cornLifeTime = Time.time - cornSpawnTime;
|
||||||
|
|
||||||
|
if (rigidbody2D.velocity.magnitude > maxVelocity)
|
||||||
|
{
|
||||||
|
maxVelocity = Mathf.Max(rigidbody2D.velocity.magnitude, maxVelocity);
|
||||||
|
Debug.Log(maxVelocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxVelocity >= 50f)
|
||||||
|
{
|
||||||
|
GetComponent<Collider2D>().enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
// アニメーション向けに回転をリセット
|
// アニメーション向けに回転をリセット
|
||||||
rotationResolverTransform.rotation = Quaternion.identity;
|
rotationResolverTransform.rotation = Quaternion.identity;
|
||||||
// コーンの回転を伝搬
|
// コーンの回転を伝搬
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||||
private Vector3 firstPos;
|
private Vector3 firstPos;
|
||||||
private Vector3 offset;
|
private Vector3 offset;
|
||||||
private readonly (float min, float max) borderX = (-1.2f, 3.1f);
|
private readonly (float min, float max) borderX = (-1.2f, 3.1f);
|
||||||
private readonly (float min, float max) borderY = (-1.1f, 0.3f);
|
private readonly (float min, float max) borderY = (-2.1f, 1.3f);
|
||||||
|
|
||||||
private Vector2 direction;
|
private Vector2 direction;
|
||||||
// public Vector2 Direction => direction;
|
// public Vector2 Direction => direction;
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,5 @@ PhysicsMaterial2D:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: PanEdge
|
m_Name: PanEdge
|
||||||
friction: 1
|
friction: 0
|
||||||
bounciness: 0
|
bounciness: 0.64
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue