void Start() { rb = transform.parent.parent.GetComponent <Rigidbody2D>(); shieldPivot = transform.parent.gameObject; shieldPivotScript = GetComponentInParent <ShieldPivot>(); playerController = transform.parent.parent.GetComponent <PlayerController>(); boostsLeft = maxBoost; }
void Awake() { player = GameObject.Find("Player"); playerController = player.GetComponent <PlayerController>(); shieldPivot = GameObject.Find("Shield Pivot"); shieldPivotScript = shieldPivot.GetComponent <ShieldPivot>(); shieldRB = GetComponent <Rigidbody2D>(); shieldDirection = shieldPivotScript.boost.normalized; shieldRB.velocity = shieldDirection * speed; }