Пример #1
0
    IEnumerator resetObstacles(Collision2D other)
    {
        ObstacleController oc = other.gameObject.GetComponent <ObstacleController>();
        int oldId             = oc.id;

        oc.nextId();
        int newId = oc.id;

        if (PlayerController.debug)
        {
            Debug.Log("Setting obstacle id " + oldId + " to " + newId);
        }

        setObstacleColor(Color.white, other.transform);

        Vector3 newPos = other.transform.position;

        newPos.x = startX;

        float startY = Random.Range(minStartY, maxStartY);

        newPos.y = startY;

        other.transform.position = newPos;

        canReset = false;
        yield return(new WaitForSeconds(0.5f));

        canReset = true;
    }