コード例 #1
0
    private void OnParticleCollision(GameObject other)
    {
        if (new string[] { "Enemy", "Obstacle", "Plant" }.Contains(other.tag))
        {
            switch (other.tag)
            {
            case "Enemy":
                other.GetComponent <Entity>().TakeDamage(Damage);
                break;

            case "Plant":
                Plant plant = other.GetComponent <Plant>();
                plant.Heal(PlantHeal);
                plant.ChangeWaterSupply(Damage);
                break;
            }
        }
    }