Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.CompareTag("Player"))
     {
         PlayerHandler player = hitInfo.GetComponent <PlayerHandler>();
         player.GetHealthSystem().Damage(dmg);
         player.CreateText(Color.red, new Vector3(player.transform.position.x, player.transform.position.y + 1), new Vector2(0, 5f), "-" + dmg);
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
    IEnumerator Attack()
    {
        animator.SetTrigger("Charging");
        StartCoroutine(ChargeAttack(1, 1f, attackPoint.GetComponent <SpriteRenderer>().color));
        yield return(new WaitForSeconds(1f));

        animator.SetTrigger("Attack");
        FindObjectOfType <AudioManager>().Play("SlashEnemy");
        SetStateNormal();
        Collider2D player = Physics2D.OverlapCircle(attackPoint.position, 0.7f, whatIsPlayer);

        if (player != null)
        {
            PlayerHandler.playerHandler.GetHealthSystem().Damage(dmg);
            playerHandler.CreateText(Color.red, new Vector3(playerHandler.transform.position.x, playerHandler.transform.position.y + 1), new Vector2(0, 5f), "-" + dmg);
        }
        yield return(new WaitForSeconds(0.2f));
    }
Exemplo n.º 3
0
 void CreateText(Vector3 pos)
 {
     playerHandler.CreateText(Color.gray, pos, new Vector2(0, 1f), "-" + dmg);
 }