void provideProtection() { if (!pause.gamepaused) { setFlag = true; currentScore = Score.scorecount; GameObject shield = Instantiate(GameObject.Find("shield"), guntransform.position, guntransform.rotation); shieldscript scr = shield.AddComponent <shieldscript>() as shieldscript; scr.obj = shield; shieldbutton.interactable = false; troopupgrade.interactable = false; } }
void Start() { rb = this.GetComponent <Rigidbody2D>(); sr = this.GetComponent <SpriteRenderer>(); shield = shieldObject.GetComponent <shieldscript>(); folder = GameObject.Find("DynamicBullets"); gameManager = GameManagerObject.GetComponent <GameManagerScript>(); energy = energyMax; health = healthMax; shield.player = this.transform.GetComponent <PlayerController>(); }