public IEnumerator FireSpell(DataPlayerChange manaBar) { if (counterSpell == 0) { if (manaBar.GetMana() >= 30) { playerAnimator.SetBool("Spell", true); manaBar.UseMana(30); counterSpell = 1; yield return(new WaitForSeconds(0.7f)); playerAnimator.SetBool("Spell", false); if (!playerSprite.flipX) { Instantiate(fireSpellRight, spawnFireBallRight.position, spawnFireBallRight.rotation); } else { Instantiate(fireSpellLeft, spawnFireBallLeft.position, spawnFireBallLeft.rotation); } yield return(new WaitForSeconds(3f)); counterSpell = 0; } } }
private void OnTriggerEnter2D(Collider2D collision) { DataPlayerChange manaBar = player.GetComponent <DataPlayerChange>(); StartCoroutine(HealMana(manaBar)); playerAnimator.SetBool("Spell", true); }
// Update is called once per frame void Update() { DataPlayerChange Bar = player.GetComponent <DataPlayerChange>(); // Start FireShot if (Input.GetButtonDown("FireShot")) { StartCoroutine(FireSpell(Bar)); } // Start Spell if Player is on The ground. if (Move_Player.instance.onTheGround) { // Regen Mana Spell. if (Input.GetButtonDown("RegenMana")) { ManaRegenSpell(Bar); } // Spell Health Regen. if (Input.GetButtonDown("RegenHealth")) { HealRegenTouch(Bar); } } }
private void Awake() { if (instance != null) { Debug.Log("Déjà DataPlayer dans la scène"); return; } instance = this; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Destroy(destroyObject); DataPlayerChange playerStam = collision.transform.GetComponent <DataPlayerChange>(); playerStam.UseStam(30); } }
public IEnumerator Replace(Collider2D collision) { transitSystem.SetTrigger("TransitIn"); yield return(new WaitForSeconds(0.15f)); collision.transform.position = playerSpawn.position; DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(10); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { HitDetection(); StartCoroutine(Change()); DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(30); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Boss_Health boss_Health = GameObject.FindGameObjectWithTag("Boss").GetComponent <Boss_Health>(); boss_Health.TakeDamage(40); DataPlayerChange playerStam = collision.transform.GetComponent <DataPlayerChange>(); playerStam.UseStam(30); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { toDest = (toDest + 1) % checkPoints.Length; theTarget = checkPoints[toDest]; enemiesSprite.flipX = !enemiesSprite.flipX; DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(30); } }
public IEnumerator HealMana(DataPlayerChange manaBar) { for (int i = 0; manaBar.GetMana() < 100; i++) { manaBar.AddMana(5); yield return(new WaitForSeconds(1f)); if (manaBar.GetMana() >= 100) { manaBar.ResetMana(); Destroy(gameObject); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Player")) { DataPlayerChange manaHealthBar = player.GetComponent <DataPlayerChange>(); playerAnimator.SetBool("Spell", true); manaHealthBar.UseMana(50); manaHealthBar.AddHealth(30); if (manaHealthBar.GetHealth() > 100) { manaHealthBar.ResetHealth(); } playerAnimator.SetBool("Spell", false); } }
private void Attack() { hit = true; // On ajoute les animations, elle se lance si first est 'true' ou bien si second est 'true'. bossAnimator.SetBool("Attack1", firstAttack); bossAnimator.SetBool("Attack2", secondAttack); // On instancie un tableau qui récupère tout les Collider qui rentre dans la hache au moment de l'attaque. Collider2D[] player_Hits = Physics2D.OverlapCircleAll(axe.position, attackRadius, playerLayer); // Pour chaque item (uniquement player ici (on prépare la possibilité de toucher deux joueurs à l'avenir)) // on récupère sa santé et on la décrémente de la puissance du Minotaure. foreach (Collider2D item in player_Hits) { DataPlayerChange playerHealth = item.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(bossDamage); } }
public void HealRegenTouch(DataPlayerChange manaBar) { if (counterSpell == 0) { if ((manaBar.GetMana() > 49) && (manaBar.GetHealth() < 100)) { counterSpell = 1; Instantiate(healRegen, spawnZone.position, spawnZone.rotation); StartCoroutine(Time()); } else { return; } } else { return; } }
public void ManaRegenSpell(DataPlayerChange manaBar) { if (counterSpell == 0) { if (manaBar.GetMana() < 100) { counterSpell = 1; Instantiate(manaRegenZone, spawnZone.position, spawnZone.rotation); StartCoroutine(Time()); } else { return; } } else { return; } }