Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        if (GameState.IsPlaying)
        {
            if (gameObject.layer == LayerMask.NameToLayer("Player"))
            {
                SphereCollider collider = GetComponent <SphereCollider>();
                float          radius   = collider.radius;
                radius = radius - 0.5f;
                if (radius < 0)
                {
                    collider.enabled = false;
                }
                else
                {
                    collider.radius = radius;
                }
                return;
            }

            gameObject.layer = LayerMask.NameToLayer("Player");

            SfxManager.PlayButterflySfx();

            target = other.gameObject.transform;

            GameState.FlockSize++;
        }
    }