private void Start() { scene = SceneManager.GetActiveScene().buildIndex; if (scene == 1) { pistolUnlock = GameObject.FindWithTag("PistolPickup").GetComponent <UnlockPistol>(); } else { hasGun = true; } gunrenderer = transform.gameObject.GetComponent <SpriteRenderer>(); cam = Camera.main; gunAnim = transform.gameObject.GetComponent <Animator>(); }
void Awake() { scene = SceneManager.GetActiveScene().buildIndex; playerbody = gameObject.GetComponent <Rigidbody2D>(); GunSprite = gameObject.GetComponent <SpriteRenderer>(); stopGame = gameObject.GetComponent <EndGame>(); if (scene == 1) { pistolUnlock = GameObject.FindWithTag("PistolPickup").GetComponent <UnlockPistol>(); pistolPickup = GameObject.FindWithTag("PistolPickup").GetComponent <Animator>(); } inventoryIndex = 0; NextShot = Time.time; is_rolling = false; playerspeed = 5f; original_playerspeed = playerspeed; roll_time = 0.3f; original_roll_time = roll_time; roll_modifier = 2.5f; }