Beispiel #1
0
    private void Awake()
    {
        layoutBounds = LayoutBounds.GetLayoutBounds();

        cam        = Camera.main;
        halfHeight = cam.orthographicSize;
        halfWidth  = halfHeight * Screen.width / Screen.height;
    }
Beispiel #2
0
    private void Awake()
    {
        layoutBounds   = LayoutBounds.GetLayoutBounds();
        targetCollider = GetComponent <BoxCollider2D>();
        if (targetCollider == null)
        {
            targetCollider = GetComponent <CircleCollider2D>();
        }

        halfWidth  = (targetCollider.bounds.max.x - targetCollider.bounds.min.x) * 0.5f;
        halfHeight = (targetCollider.bounds.max.y - targetCollider.bounds.min.y) * 0.5f;
    }
Beispiel #3
0
    public static LayoutBounds GetLayoutBounds()
    {
        GameObject layoutBoundsObject = GameObject.Find("LayoutBounds");

        if (layoutBoundsObject != null)
        {
            LayoutBounds layoutBounds = layoutBoundsObject.GetComponent <LayoutBounds>();
            if (layoutBounds != null)
            {
                return(layoutBounds);
            }
            else
            {
                Debug.Log("Cannot find LayoutBounds behavior on GameObject with name of LayoutBounds");
                return(null);
            }
        }

        Debug.Log("Cannot find GameObject with name of LayoutBounds");
        return(null);
    }
Beispiel #4
0
 private void Awake()
 {
     layoutBounds = LayoutBounds.GetLayoutBounds();
     monstersRoot = GameObject.Find("Monsters").transform;
 }
 private void Awake()
 {
     layoutBounds = LayoutBounds.GetLayoutBounds();
 }
Beispiel #6
0
 private void Awake()
 {
     layoutBounds   = LayoutBounds.GetLayoutBounds();
     bulletMovement = GetComponent <BulletMovement>();
 }