Ejemplo n.º 1
0
    private void OnTriggerStay2D(Collider2D collision)      // function for handling trigger entering (staying on something goes here)
    {
        if (direction == 0)
        {
            if (collision.CompareTag("FenceFront"))
            {
                InFrontOfFence = true;
                //Debug.Log("Player is in front of the fence");
            }

            if (collision.CompareTag("FenceBack"))
            {
                AtBackOfFence = true;
                //Debug.Log("Player is at back of the fence");
            }

            if (collision.CompareTag("WaterCollider"))
            {
                OnWater = true;
                //Debug.Log("Player is on water");
            }

            if (collision.CompareTag("FloatingObjectLog"))
            {
                OnWaterObjectLog = true;
                //Debug.Log("Player is on log");
            }

            if (collision.CompareTag("FloatingObjectLily"))
            {
                OnWaterObjectLily = true;
                //Debug.Log("Player is on lily");
            }

            if (collision.CompareTag("FinishCollider"))
            {
                //Debug.Log("Passed");
                HasPassed            = true;
                Settings.ScoreCount += 150 * (Settings.Difficulty - 1);
                StartCoroutine(Event_Passed_To_Other_Side());
            }

            if (collision.CompareTag("ScoreCollider"))
            {
                Vector3 movescorecollider = GameBoardScript.ScoreCollider.transform.position;
                movescorecollider.y++;
                GameBoardScript.ScoreCollider.transform.position = movescorecollider;

                //Debug.Log("Score + 5");
                GameBoardScript.AddScore(false);                // false - add score normally
            }
        }
    }