Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("PlayerHitbox") && other.GetComponentInChildren <PlayerChargingUp>().EmissionState())
        {
            other.GetComponentInChildren <PlayerChargingUp>().RemoveCharge();
            other.GetComponentInParent <MovementGeneratedParticles>().SoundFadeOutMethod();
            if (other.GetComponentInChildren <PlayerChargingUp>().insideCharger)
            {
                rayFromTree.RayChargeMethod();
            }

            GameObject starPickedUpRef = p.CreatePickedUpRef(transform.GetChild(0).name, gameObject);
            starPickedUpRef.GetComponent <StarPickedUp>().thisStarVertex = thisStarVertex;

            foreach (GameObject starIndicator in starCountIndicators)
            {
                starIndicator.GetComponent <StarCountIndicator>().ActivateStarIndicators();
            }
            if (puzzleGameObj != null)
            {
                starPickedUpRef.GetComponent <StarPickedUp>().hasPuzzle = true;
                puzzleGameObj.SetActive(true);
            }
            if (lightsAroundStar != null)
            {
                lightsAroundStar.GetComponent <TriggerLights>().GraduallyTurnOnLightsMethod();
            }
            if (spawnRef != null)
            {
                spawnRef.SpawnObjects();
            }
            Destroy(indicator);
            Destroy(transform.parent.gameObject);
        }
    }