本文整理汇总了C#中UnityEngine.Rigidbody2D类的典型用法代码示例。如果您正苦于以下问题:C# Rigidbody2D类的具体用法?C# Rigidbody2D怎么用?C# Rigidbody2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rigidbody2D类属于UnityEngine命名空间,在下文中一共展示了Rigidbody2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixedUpdate
protected virtual void FixedUpdate()
{
if (rigidbody2d == null) rigidbody2d = GetComponent<Rigidbody2D>();
Velocity = rigidbody2d.velocity;
AngularVelocity = rigidbody2d.angularVelocity;
}
示例2: Awake
void Awake()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
aud = GetComponent<AudioSource>();
jps = transform.GetChild(2).GetComponent<ParticleSystem>();
}
示例3: Awake
void Awake()
{
Transform canvas = transform.Find("Canvas");
Group = canvas.GetComponent<CanvasGroup>();
Text = canvas.Find("Text").GetComponent<Text>();
Rigidbody = GetComponent<Rigidbody2D>();
}
示例4: Start
// Use this for initialization
void Start () {
//必要な情報の取得
rigid = GetComponent<Rigidbody2D>();
sprite = GetComponent<SpriteRenderer>();
}
示例5: Init
void Init(){
Player = GameObject.FindGameObjectWithTag("Player");
direction = Player.GetComponent<Player_Control>().VecDirection;
rb = gameObject.GetComponent<Rigidbody2D>();
rb.AddForce(direction*moveSpeed);
}
示例6: Start
void Start()
{
transform = GetComponent<Transform> ();
rb = GetComponent<Rigidbody2D> ();
player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Rigidbody2D> ();
}
示例7: Start
// Use this for initialization
void Start()
{
this.koopaShellScript = this.transform.parent.GetComponent<KoopaShellScript> ();
this.player = GameObject.FindWithTag ("Player");
this.playerScript = this.player.GetComponent<PlayerScript>();
this.playerRb = this.player.GetComponent<Rigidbody2D>();
}
示例8: Awake
void Awake()
{
Object.DontDestroyOnLoad(gameObject);
rb = gameObject.GetComponent<Rigidbody2D> ();
Application.LoadLevel (1);
inEndSequence = false;
}
示例9: Start
// Use this for initialization
void Start()
{
cameraRigidbody = GetComponent<Rigidbody2D> ();
cameraRigidbody.gravityScale = 0;
//lastPosition = player.transform.position;
}
示例10: Start
// Use this for initialization
void Start()
{
rockGet = GetComponent<AudioSource>();
rb = GetComponent<Rigidbody2D>();
playerScore = 0;
Moving = true;
}
示例11: Awake
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private void Awake() {
// Setting up references.
m_GroundCheck = transform.Find("GroundCheck");
m_CeilingCheck = transform.Find("CeilingCheck");
m_Anim = GetComponent<Animator>();
m_Rigidbody2D = GetComponent<Rigidbody2D>();
}
示例12: Start
void Start()
{
ThisBody = GetComponent<Rigidbody2D>();
Anim = GetComponent<Animator>();
TailLight = Light.GetComponent<Light>();
// SpriteRen = GetComponent<SpriteRenderer>();
}
示例13: OnDestructibleSplit
protected virtual void OnDestructibleSplit(D2D_SplitData splitData)
{
if (rigidbody2d == null) rigidbody2d = GetComponent<Rigidbody2D>();
rigidbody2d.velocity = Velocity;
rigidbody2d.angularVelocity = AngularVelocity;
}
示例14: Start
// Use this for initialization
void Start () {
rbd2D = GetComponent<Rigidbody2D> ();
anim = GetComponent<Animator> ();
aL = (Arrow_Launch)FindObjectOfType (typeof(Arrow_Launch));
directEnemy = (Enemy_Controller)FindObjectOfType (typeof(Enemy_Controller));
pStatus = (Player_Status)FindObjectOfType (typeof(Player_Status));
}
示例15: Start
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody2D>();
sr = GetComponent<SpriteRenderer>();
limits = Camera.main.ViewportToWorldPoint(Vector3.right).x -
HalfWidth;
time = shootTime;
}