吹っ飛び追加

This commit is contained in:
kimura 2021-06-25 18:41:08 +09:00
parent 43b66bb0ca
commit dbaa7d294a
3 changed files with 16 additions and 4 deletions

View File

@ -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;
// コーンの回転を伝搬 // コーンの回転を伝搬

View File

@ -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;

View File

@ -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