当前位置: 首页>>代码示例>>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;未经允许,请勿转载。