// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); drill = GetComponentInChildren <DrillController>(); playerAnimator = transform.GetChild(0).GetComponent <Animator>(); drillAnimator = drill.GetComponent <Animator>(); playerSprite = transform.GetChild(0).gameObject; }
// Use this for initialization void Start() { GameObject drillObject = GameObject.Find("DrillObject"); GameObject uiObject = GameObject.Find("Main Game UI"); drillController = drillObject.GetComponent <DrillController> (); uiAudioSource = uiObject.GetComponent <AudioSource> (); floatingRises = true; }
// for when the bullet hits something void OnCollisionEnter2D(Collision2D coll) { DrillController drillController = drill.GetComponent <DrillController>(); //If the target is an enemy, take health off them if (coll.gameObject.tag == "Enemy") { script = coll.gameObject.GetComponent <EnemyController2D>(); script.DealLaserDamage(1 * drillController.turretDamage); } this.gameObject.SetActive(false); //Reset the timer for the bullet being reset scriptTimer = timerReset.GetComponent <TurretFiring>(); scriptTimer.ResetTimer(); }
private void Start() { drillController = GameObject.FindGameObjectWithTag("DrillController").GetComponent <DrillController>(); }