2017-04-12 01:23:07 +09:00

24 lines
567 B
C#

using UnityEngine;
[AddComponentMenu("Destructible 2D/D2D Top Down Thruster")]
public class D2D_TopDownThruster : MonoBehaviour
{
public Rigidbody2D body;
public float Throttle;
public float MoveSpeed = 50.0f;
public float TurnSpeed = 5.0f;
protected virtual void FixedUpdate()
{
transform.localScale = new Vector3(Throttle, Throttle, Throttle);
if (body != null)
{
body.velocity += Throttle * MoveSpeed * Time.fixedDeltaTime * (Vector2)transform.up;
body.angularVelocity += Throttle * TurnSpeed * Time.fixedDeltaTime;
}
}
}