Exemple #1
0
    public void CreateOther()
    {
        if (CurrentLeftBounds == null)
        {
            CurrentLeftBounds = Instantiate(leftBounds).GetComponent <Bound>();
        }

        if (CurrentRightBounds == null)
        {
            CurrentRightBounds = Instantiate(rightBounds).GetComponent <Bound>();
        }

        CurrentLeftBounds.transform.position  = new Vector3(-transform.GetComponent <BoxCollider2D>().size.x / 2 + transform.localPosition.x, 0, 0); CurrentLeftBounds.gameObject.name = "Left";
        CurrentRightBounds.transform.position = new Vector3(transform.GetComponent <BoxCollider2D>().size.x / 2 + transform.localPosition.x, 0, 0); CurrentRightBounds.gameObject.name = "Right";

        CurrentLeftBounds.LeftWay   = gameObject;
        CurrentRightBounds.RightWay = gameObject;

        CurrentLeftBounds.CreateNextWay();
        CurrentRightBounds.CreateNextWay();
    }