コード例 #1
0
    private IEnumerator Attack(Direction direction)
    {
        float rotation = 0;

        switch (direction)
        {
        case Direction.North:
            rotation = -90;
            break;

        case Direction.East:
            rotation = 180;
            break;

        case Direction.South:
            rotation = 90;
            break;

        case Direction.West:
            rotation = 0;
            break;
        }

        hitboxObject.transform.rotation = Quaternion.Euler(0, 0, rotation);
        canAttack = false;
        //todo kijk of tie aanvalt
        yield return(new WaitForEndOfFrame());

        Debug.Log("Attack");
        damager.DamageCollisions();
        yield return(new WaitForSeconds(attackTime));

        StartCoroutine(Cooldown());
    }