public void EnablePowerUpHud(PoweUpType type) { if (type == PoweUpType.METAL) { //Enable Metal Sprite metal_hud.SetActive(true); slowmo_hud.SetActive(false); star_hud.SetActive(false); } else if (type == PoweUpType.STAR) { //Enable Star Sprite star_hud.SetActive(true); metal_hud.SetActive(false); slowmo_hud.SetActive(false); } else if (type == PoweUpType.SLOW) { //Enable Slow-Mo Sprite slowmo_hud.SetActive(true); star_hud.SetActive(false); metal_hud.SetActive(false); } powerup_bar.fillAmount = 1.0f; }
void Start() { soundEffect = soundEffectObj.GetComponent <SoundEffect>(); isRolling = false; shotCount = 0; spriteRenderer = GetComponent <SpriteRenderer>(); type_ = PoweUpType.Plain; deadLine = mainCamera.ViewportToWorldPoint(new Vector2(0, 0)).x - 1; }
public void DisablePowerUpHUD(PoweUpType type) { if (type == PoweUpType.METAL) { //Enable Metal Sprite metal_hud.SetActive(false); } else if (type == PoweUpType.STAR) { //Enable Star Sprite star_hud.SetActive(false); } else if (type == PoweUpType.SLOW) { //Enable Slow-Mo Sprite slowmo_hud.SetActive(false); } //Reset Time Bar powerup_bar.fillAmount = 0.0f; }
public void OnDamaged(Collider2D other) { speed.x += 5; rotationSpeed += 90; shotCount += 1; switch (shotCount) { case 5: spriteRenderer.sprite = spriteSpeedUp; type_ = PoweUpType.SpeedUp; break; case 10: spriteRenderer.sprite = spriteTwinShot; type_ = PoweUpType.TwinShot; break; case 20: spriteRenderer.sprite = spriteTripleShot; type_ = PoweUpType.TripleShot; break; case 30: spriteRenderer.sprite = spriteOption; type_ = PoweUpType.Option; break; default: spriteRenderer.sprite = spritePlain; type_ = PoweUpType.Plain; break; } soundEffect.playItemShot(); }
public void ActivePowerUp(PoweUpType type, float duration, float speed_slow = 0.0f) { if (type == PoweUpType.METAL) { if (star_active) { current_time_star = 0.0f; star_active = false; } else if (slow_active) { slow_active = false; current_time_slow = 0.0f; //Call function Normal Speed nodeManager.GetComponent <NodeManager>().ResetObstaclesSpeed(); } script_star.GetComponent <Renderer>().material = metal_mat; script_star.GetComponent <ScrollingUVs_Layers>().enabled = true; score.AddScore(ScoreType.POWERUP_ARMOR); armor_active = true; duration_armor = duration; current_time_armor = 0.0f; source.PlayOneShot(MetalSound); } else if (type == PoweUpType.STAR) { if (armor_active) { current_time_armor = 0.0f; armor_active = false; } else if (slow_active) { slow_active = false; current_time_slow = 0.0f; nodeManager.GetComponent <NodeManager>().ResetObstaclesSpeed(); } script_star.GetComponent <Renderer>().material = star_mat; script_star.GetComponent <ScrollingUVs_Layers>().enabled = true; score.AddScore(ScoreType.POWERUP_STAR); star_active = true; duration_star = duration; current_time_star = 0.0f; } else if (type == PoweUpType.SLOW) { if (armor_active) { current_time_armor = 0.0f; armor_active = false; } else if (star_active) { current_time_star = 0.0f; star_active = false; } source.PlayOneShot(SlowDown); camerasource.pitch = 0.6f; script_star.GetComponent <Renderer>().material = normal_mat; script_star.GetComponent <ScrollingUVs_Layers>().enabled = false; score.AddScore(ScoreType.POWERUP_SLOW); slow_active = true; duration_slow = duration; current_time_slow = 0.0f; //Call function save_time_trail = GetComponent <TrailRenderer>().time; GetComponent <TrailRenderer>().time = new_time_trail; nodeManager.GetComponent <NodeManager>().ChangeSpeed(speed_slow); save_slow_reduced = speed_slow; } EnablePowerUpHud(type); }