Пример #1
0
    private void OnTriggerStay(Collider other)
    {
        if (!collected)
        {
            // Debug.Log("Triggered by: " + other.name);
            Debug.Log("Collecting a collectible");

            HotAirBalloon hotAirBalloon = other.GetComponentInParent <HotAirBalloon>();

            if (hotAirBalloon)
            {
                collected = true;
                GameState.NewCollectibles.Add(this.gameObject);

                CollectibleCollectEffect effect = GetComponent <CollectibleCollectEffect>();
                if (effect)
                {
                    effect.BeginEffect(hotAirBalloon);
                }
                else
                {
                    GetComponent <Transform>().localScale = Vector3.zero;
                }
            }
            // } else {
            // Debug.Log("Ignoring trigger from: " + other.name);
        }
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        HotAirBalloon hotAirBalloon = other.GetComponentInParent <HotAirBalloon>();

        if (hotAirBalloon)
        {
            GameState.NewMilkBottles += 1;
            Destroy(this);

            CollectibleCollectEffect effect = GetComponent <CollectibleCollectEffect>();
            if (effect)
            {
                effect.BeginEffect(hotAirBalloon);
            }
            else
            {
                GetComponent <Transform>().localScale = Vector3.zero;
            }
        }
    }