コード例 #1
0
    void onExitExclusionZone(GameObject obj)
    {
        PlanetEffect effect = obj.GetComponent <PlanetEffect>();

        if (effect)
        {
            effect.effectActive = true;
            effect.GetComponent <Rigidbody>().useGravity = false;
        }
    }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.attachedRigidbody)
        {
            MTK_Interactable interactable = other.attachedRigidbody.GetComponent <MTK_Interactable>();
            if (interactable && interactable.isGrabbable && !interactable.isDistanceGrabbed)
            {
                UpdateTPZone(interactable.GetComponent <IcoPlanet>(), true);

                if (!other.attachedRigidbody.gameObject.GetComponent <PlanetEffect>())
                {
                    if (!other.GetComponentInParent <IcoSegment>())
                    {
                        PlanetEffect eff = other.attachedRigidbody.gameObject.AddComponent <PlanetEffect>();
                        if (eff)
                        {
                            eff.maxSpeed          = m_maxSpeed;
                            eff.accelerationForce = m_accelerationForce;
                            eff.impactForce       = impactForce;
                            eff.sunRigidbody      = m_rb;
                            m_planetEffectsList.Add(eff);

                            eff.explosionEffect = m_explosionEffect;

                            UpdateState(m_planetEffectsList.Count);

                            if (m_exclusionPlatform.m_objectsInTrigger.Contains(eff.gameObject))
                            {
                                eff.effectActive = false;
                                eff.GetComponent <Rigidbody>().useGravity = true;
                            }
                        }
                    }
                }
            }
        }
    }