public void Use() { if (!pressed) { pressed = true; if (placed && placedMine == null) { placed = false; playerUI?.AbilityCooldown(timeout, controller.playerNr); } if (!placed && canPlace) { AudioManager1.instance.Play(toxicMineSound); placedMine = Instantiate(minePrefab, transform.position, Quaternion.identity).GetComponent <Explosive_ContactDamage>(); placedMine.gameObject.layer = mineLayer; placedMine.transform.Find("Outline").GetComponent <SpriteRenderer>().color = controller.playerColor; //StartCoroutine(Cooldown()); placed = true; canPlace = false; } else if (placed) { placedMine.Explode(); placed = false; playerUI?.AbilityCooldown(timeout, controller.playerNr); } } }
public void Use() { if (canAttack && !pressed) { canAttack = false; pressed = true; healthController.Stun(invincibilityTime, false); Collider2D[] targetColliders = Physics2D.OverlapCircleAll(transform.position, radius, gravMask); for (int i = 0; i < targetColliders.Length; i++) { IMovable newTarget = targetColliders[i].GetComponent <IMovable>(); if (newTarget == null) { newTarget = targetColliders[i].attachedRigidbody?.GetComponent <IMovable>(); } if (newTarget != null) { newTarget.ApplyTempExForce((transform.position - targetColliders[i].transform.position).normalized * force, forceTime); } } playerUI?.AbilityCooldown(timeout, playerNr); } }
public void Use() { if (canAttack && !inAction && !pressed) { canAttack = false; inAction = true; controller.AbilityStun(true, true); currentNuke = Instantiate(nukePrefab, transform.position, origin.rotation); currentNuke.layer = nukeLayer; currentNuke.GetComponent <WeaponController_Nuke>().playerNr = playerNr; currentNuke.GetComponent <WeaponController_Nuke>().playerLayer = gameObject.layer; currentNuke.transform.Find("Outline").GetComponent <SpriteRenderer>().color = controller.playerColor; } else if (inAction && currentNuke == null) { inAction = false; controller.AbilityStun(false); playerUI?.AbilityCooldown(timeout, playerNr); } }
public void Use() { if (canHeal && !isPressed) { healParticles.Play(); //controller.AbilityStun(true); //StartCoroutine(HealOverTime()); canHeal = false; healthController.Heal(healthBonus); playerUI?.AbilityCooldown(healTimeout, playerNr); } isPressed = true; }
public void Use() { if (!pressed && canClone) { pressed = true; canClone = false; GameObject newClone = Instantiate(clonePrefab, transform.position, Quaternion.identity, transform); GameManager.SetLayer(newClone.transform, gameObject.layer); newClone.GetComponent <PlayerController>().playerNr = controller.playerNr; newClone.GetComponent <PlayerController>().playerColor = controller.playerColor; playerUI?.AbilityCooldown(timeout, controller.playerNr); } }
public void Use() { if (canDash && !isPressed && playerMovement.direction != Vector2.zero) { playerMovement.ApplyTempExForce(playerMovement.direction.normalized * speed, duration); controller.AbilityStun(true); canDash = false; playerUI?.AbilityCooldown(timeout, controller.playerNr); } else if (!canDash) { controller.AbilityStun(false); } isPressed = true; }
public void Use() { if (canAttack && !pressed) { AudioManager1.instance.Play(iceSound); waveParticles.Play(); canAttack = false; pressed = true; Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, radius, hitMask); for (int i = 0; i < hits.Length; i++) { HitCollider(hits[i]); } playerUI?.AbilityCooldown(cooldown, playerNr); } }