當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEngine.Rigidbody2D類代碼示例

本文整理匯總了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;
    }
開發者ID:rickbatka,項目名稱:birds,代碼行數:7,代碼來源:D2D_ImpartVelocity.cs

示例2: Awake

 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D>();
     anim = GetComponent<Animator>();
     aud = GetComponent<AudioSource>();
     jps = transform.GetChild(2).GetComponent<ParticleSystem>();
 }
開發者ID:9,項目名稱:Swordface2.5D,代碼行數:7,代碼來源:IcosaEnemyBrain.cs

示例3: Awake

 void Awake()
 {
     Transform canvas = transform.Find("Canvas");
     Group = canvas.GetComponent<CanvasGroup>();
     Text = canvas.Find("Text").GetComponent<Text>();
     Rigidbody = GetComponent<Rigidbody2D>();
 }
開發者ID:Mykaelos,項目名稱:MykaelosUnityLibrary,代碼行數:7,代碼來源:FloatingText.cs

示例4: Start

	// Use this for initialization
	void Start () {

		//必要な情報の取得 
		rigid = GetComponent<Rigidbody2D>();
		sprite = GetComponent<SpriteRenderer>();
		
	}
開發者ID:inouexyz,項目名稱:unitySample,代碼行數:8,代碼來源:EnemyMove.cs

示例5: Init

	void Init(){
		Player = GameObject.FindGameObjectWithTag("Player");
		direction = Player.GetComponent<Player_Control>().VecDirection;
		rb = gameObject.GetComponent<Rigidbody2D>();
		rb.AddForce(direction*moveSpeed);

	}
開發者ID:kayodeaking,項目名稱:The-Game-Of-Love-1.0-,代碼行數:7,代碼來源:Spell.cs

示例6: Start

    void Start()
    {
        transform = GetComponent<Transform> ();
        rb = GetComponent<Rigidbody2D> ();

        player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Rigidbody2D> ();
    }
開發者ID:tvance989,項目名稱:wizard-game,代碼行數:7,代碼來源:EnemyController.cs

示例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>();
 }
開發者ID:pedronalbert,項目名稱:maduro-bros-unity,代碼行數:8,代碼來源:KoopaShellHitAreaScript.cs

示例8: Awake

 void Awake()
 {
     Object.DontDestroyOnLoad(gameObject);
     rb = gameObject.GetComponent<Rigidbody2D> ();
     Application.LoadLevel (1);
     inEndSequence = false;
 }
開發者ID:Avekeez,項目名稱:Space-Wars-Unity,代碼行數:7,代碼來源:TitleLogic.cs

示例9: Start

    // Use this for initialization
    void Start()
    {
        cameraRigidbody = GetComponent<Rigidbody2D> ();
        cameraRigidbody.gravityScale = 0;

        //lastPosition = player.transform.position;
    }
開發者ID:MilesMeacham,項目名稱:TankGame,代碼行數:8,代碼來源:MyCamera.cs

示例10: Start

 // Use this for initialization
 void Start()
 {
     rockGet = GetComponent<AudioSource>();
     rb = GetComponent<Rigidbody2D>();
     playerScore = 0;
     Moving = true;
 }
開發者ID:Djomanix,項目名稱:HyruleGame,代碼行數:8,代碼來源:PLayerController.cs

示例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>();
    }
開發者ID:JosephLandy,項目名稱:stardust-holepuncher,代碼行數:9,代碼來源:CharacterMovement.cs

示例12: Start

 void Start()
 {
     ThisBody = GetComponent<Rigidbody2D>();
     Anim = GetComponent<Animator>();
     TailLight = Light.GetComponent<Light>();
     // SpriteRen = GetComponent<SpriteRenderer>();
 }
開發者ID:JasonSlingsCode,項目名稱:CNR,代碼行數:7,代碼來源:HealthScript.cs

示例13: OnDestructibleSplit

    protected virtual void OnDestructibleSplit(D2D_SplitData splitData)
    {
        if (rigidbody2d == null) rigidbody2d = GetComponent<Rigidbody2D>();

        rigidbody2d.velocity        = Velocity;
        rigidbody2d.angularVelocity = AngularVelocity;
    }
開發者ID:rickbatka,項目名稱:birds,代碼行數:7,代碼來源:D2D_ImpartVelocity.cs

示例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));
	}
開發者ID:godfavornoone,項目名稱:TWTW-Real,代碼行數:8,代碼來源:Player_Controller.cs

示例15: Start

	// Use this for initialization
	void Start () {
        rb = GetComponent<Rigidbody2D>();
        sr = GetComponent<SpriteRenderer>();
        limits = Camera.main.ViewportToWorldPoint(Vector3.right).x -
            HalfWidth;
        time = shootTime;
    }
開發者ID:santii810,項目名稱:Dam209,代碼行數:8,代碼來源:Player.cs


注:本文中的UnityEngine.Rigidbody2D類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。