コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "cube" || other.gameObject.tag == "point")
        {
            if (IsValid(other.gameObject))
            {
                if (!Spawner.dropEffect)
                {
                    PPInGame.Success();
                }

                scoring.CubeDestroyed();
                Destroy(other.transform.parent.gameObject);
            }
            else
            {
                PPInGame.Fail();
                scoring.CubeMissed();

                if (other.transform.parent && other.transform.parent.GetComponent <Cube>())
                {
                    Destroy(other.transform.parent.gameObject);
                }
                else
                {
                    Destroy(other.gameObject);
                }
            }
        }
    }