Esempio n. 1
0
    IEnumerator PrepareAttack(Vector2 direction)
    {
        status.FlashSpriteColor(AttackAnticipation, new Color(255, 255, 255, 255));
        status.Stun(AttackAnticipation);

        yield return(new TimeManager.WaitForSeconds(AttackAnticipation + 0.02f));

        time_since_last_attack = 0;
        attacking = false;
        weapon.Attack(direction);

        // if little enemy, do this else

        if (gameObject.name == "AOE Enemy")
        {
            SoundManager.PlaySound(SoundManager.Sound.BEnemy1);
        }
        else
        {
            int idx = Random.Range(0, 3);

            SoundManager.PlaySound(LittleSounds[idx]);
        }


        if (direction.x > 0)
        {
            transform.localScale = new Vector3(1, 1, 1);
        }
        else
        {
            transform.localScale = new Vector3(-1, 1, 1);
        }
    }