using System;
using UniRx;
using UniRx.Triggers;
using UnityEngine;

namespace MyGame.Scenes.MiniGame.Scripts
{
    public class StageItem : MonoBehaviour
    {
        public enum Type
        {
            Item1,
            Obstacle,
        }

        [SerializeField] private Type itemType;
        public Type ItemType => itemType;
        [SerializeField] private int point;

        public int Point => point;

        private void Start()
        {
            this.OnTriggerEnter2DAsObservable()
                .Take(1)
                .Subscribe(_ =>
                {
                    // effect
                    switch (itemType)
                    {
                        case Type.Item1:
                            gameObject.SetActive(false);
                            break;
                        case Type.Obstacle:
                            break;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                }).AddTo(this);
        }
    }
}