// Update is called once per frame void Update() { if (!b.isAvailable) { GetComponent <Image>().sprite = cadenasSprite; canvasGroup.alpha = 0.5f; cooldownBar.GetComponent <CanvasGroup>().alpha = 0; } else { GetComponent <Image>().sprite = spr; cooldownBar.GetComponent <CanvasGroup>().alpha = 1; if (cooldown.cooldownStarted) { b.isClickacble = false; canvasGroup.alpha = 0.5f; } else { canvasGroup.alpha = 1; b.isClickacble = true; } } if (animationStart && frame <= 5) { frame++; float spd = -(1.1f / 50) * frame; GetComponent <RectTransform>().sizeDelta = baseSize * (spd + 1); } b.isAvailable = b.CheckUnlock(); }
void updateSwapAttack() { float cooldown_progress = (Time.time - swap_attack_cooldown_start) / swap_attack_cooldown; swap_attack_cooldown_bar.GetComponent <CooldownBar>().setProgress(Mathf.Min(cooldown_progress, 1f)); if ((!Input.GetKey(SWAP_ATTACK_KEY) && !GamePadInput.S.leftBumperPressed(player)) || cooldown_progress < 1.0f || fire_bullet_vector == Vector2.zero) { return; } GameObject new_swap_attack = Instantiate(swap_attack_prefab) as GameObject; new_swap_attack.GetComponent <SwapAttack>().source_player_id = this.GetComponent <PlayerManager>().player_id; new_swap_attack.GetComponent <SwapAttack>().movement_vector = fire_bullet_vector; new_swap_attack.transform.position = this.transform.position; new_swap_attack.GetComponent <SwapAttack>().bullet_team = this.GetComponent <PlayerManager>().Team; swap_attack_cooldown_start = Time.time; }