コーン回転対応
This commit is contained in:
parent
5a77fc1be4
commit
9cacb78774
|
|
@ -27,11 +27,15 @@ public class Corn : MonoBehaviour
|
|||
private bool isPop;
|
||||
|
||||
private Rigidbody2D rigidbody2D;
|
||||
private Transform animePivotTransform;
|
||||
private Transform spriteTransform;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
spriteTransform = spriteRenderer.transform;
|
||||
animePivotTransform = spriteRenderer.transform.parent;
|
||||
spriteRenderer.sprite = cornSeedSprite;
|
||||
cornSpawnTime = Time.time;
|
||||
var cornPopBasicTime = 5f;
|
||||
|
|
@ -44,6 +48,11 @@ public class Corn : MonoBehaviour
|
|||
{
|
||||
cornVelocity = rigidbody2D.velocity.magnitude;
|
||||
cornLifeTime = Time.time - cornSpawnTime;
|
||||
|
||||
// コーンの回転を伝搬
|
||||
spriteTransform.localRotation = transform.localRotation;
|
||||
animePivotTransform.localRotation = Quaternion.Inverse(transform.localRotation);
|
||||
|
||||
if (cornVelocity <= 0.2f)
|
||||
{
|
||||
cornStopTime += Time.deltaTime;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ Rigidbody2D:
|
|||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 4
|
||||
m_Constraints: 0
|
||||
--- !u!58 &8932234855615206969
|
||||
CircleCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue