Beispiel #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Rotator")
        {
            transform.SetParent(col.transform);

            isPinned = true;
            if (!GameManager.instance.gameHasEnded)
            {
                float   pinDegrees = col.transform.eulerAngles.z;
                Rotator rot        = col.GetComponent <Rotator>();

                List <float> allPinsDegrees = rot.GetPinsDegrees();
                float        smaller, greater;
                rot.AddPinDegrees(pinDegrees, out smaller, out greater);

                Debug.Log("Degrees: " + pinDegrees + " S: " + smaller + " G: " + greater);


                Score.PinCount += 1;
            }
        }
        else if (col.tag == "Pin")
        {
            this.GetComponent <SpriteRenderer>().color = Color.red;
            GameManager.instance.EndGame();
        }
    }