private void Awake() { playerBehavior player = playerBehavior.current; playerShootingBehavior.current = this; this.projectileBuffType = "none"; currentProjectile = playerProjectile; }
//Checks for collision of power up with player, destroys when condition fufilled private void OnTriggerEnter2D(Collider2D collision) { playerShootingBehavior shooting = collision.GetComponent <playerShootingBehavior>(); if (shooting != null) { if (Input.GetKey(KeyCode.Mouse0) == true) { shooting.keydown = true; } shooting.UpgradeProjectile(bufftype, Time.time); //Function to increase speed UIMaster.current.projectileicondict[bufftype].SetActive(true); // Activates speed timer Destroy(this.gameObject); } }
// Update is called once per frame void Update() { playerShootingBehavior shooter = playerShootingBehavior.current; //Checking for shield buff if (shooter.projectileBuffType == projectileBuffName) { progress.fillAmount = 1f - (Time.time - shooter.projectileBuffTime) / shooter.maxProjectileBuffTimer; //Check if Buff time is over if (Time.time - shooter.projectileBuffTime >= shooter.maxProjectileBuffTimer) { shooter.projectileBuffType = "none"; } } else { this.gameObject.SetActive(false); if (shooter.projectileBuffType == "none") { shooter.NoProjectileBuff(); } } }