private void Awake() { sj = GetComponent <SpringJoint2D>(); // 获取弹簧关节 rg = GetComponent <Rigidbody2D>(); // 获取刚体组件 birdTrail = GetComponent <BirdTrail>(); // 获取拖尾脚本 render = GetComponent <SpriteRenderer>(); // 获取精灵渲染器 }
//public AudioClip dead; // Use this for initialization void Awake() { sp = GetComponent <SpringJoint2D>(); rb = GetComponent <Rigidbody2D>(); trail = GetComponent <BirdTrail>(); sRenderer = GetComponent <SpriteRenderer>(); }
protected virtual void Awake() { if (!mainCamera) { mainCamera = Camera.main; } rigi = GetComponent <Rigidbody2D>(); springJoint = GetComponent <SpringJoint2D>(); circleCollider = GetComponent <CircleCollider2D>(); spriteRender = GetComponent <SpriteRenderer>(); birdTrail = transform.GetComponentInChildren <BirdTrail>(); if (!rightBranch) { rightBranch = GameObject.Find("Branch/Branch_Right").GetComponent <Branch>(); } if (!leftBranch) { leftBranch = GameObject.Find("Branch/Branch_Left").GetComponent <Branch>(); } circleCollider.enabled = false; rigi.bodyType = RigidbodyType2D.Static; }