Beispiel #1
0
        public void Attack()
        {
            OnAttackEvent?.Invoke();
            ProjectileBase arrow = Instantiate(arrowPrefab);

            arrow.Reset();
            arrow.transform.localEulerAngles = projectileRotation[(int)facing];
            Vector2 dir;

            switch (facing)
            {
            case Facing.Front:
                dir = Vector2.down;
                break;

            case Facing.Back:
                dir = Vector2.up;
                break;

            case Facing.Left:
                dir = Vector2.left;
                break;

            case Facing.Right:
                dir = Vector2.right;
                break;

            default:
                dir = Vector2.down;
                break;
            }

            arrow.Launch(dir, attackPoint.position);
        }