コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        HealthManager healthManager = other.gameObject.GetComponent <HealthManager>();

        if (other.gameObject.tag == "Player")
        {
            switch (chooseState)
            {
            case AddState.AddHealth:
                healthManager.ApplyHeal(healthValue);
                Destroy(gameObject);
                break;

            case AddState.AddLife:
                healthManager.AddBounsLife(lifeAmount);
                Destroy(gameObject);
                break;
            }
        }
    }