Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "Goal")
        {
            foreach (SimpleRotation s in other.gameObject.GetComponentsInChildren <SimpleRotation>())
            {
                s.enabled = false;
                // TODO fix
                s.gameObject.transform.localEulerAngles = new Vector3(12.439f, -28.887f, 58.768f);
                s.gameObject.transform.localPosition    = new Vector3(-0.0101f, 0.0243f, 0.0017f);
            }
            UserInterface.instance.CollectGoal();
            other.gameObject.transform.SetParent(leftHand);
            other.gameObject.transform.localPosition    = Vector3.zero;
            other.gameObject.transform.localEulerAngles = Vector3.zero;
            other.gameObject.GetComponentInChildren <SpriteRenderer>().enabled = false;
        }

        if (other.gameObject.tag == "DifficultyTrigger")
        {
            EnemyGlobalSettings.NextLevel();
            Destroy(other.gameObject);
        }

        if (other.gameObject.tag == "Health")
        {
            currentLife = maxLife;
            UserInterface.instance.RefreshPlayerStats();
            other.gameObject.GetComponent <Collectable>().Collect();
            AudioManager.instance.PlaySound("Heart_Collect");
        }
    }