private void Awake() { layoutBounds = LayoutBounds.GetLayoutBounds(); cam = Camera.main; halfHeight = cam.orthographicSize; halfWidth = halfHeight * Screen.width / Screen.height; }
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; }
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); }
private void Awake() { layoutBounds = LayoutBounds.GetLayoutBounds(); monstersRoot = GameObject.Find("Monsters").transform; }
private void Awake() { layoutBounds = LayoutBounds.GetLayoutBounds(); }
private void Awake() { layoutBounds = LayoutBounds.GetLayoutBounds(); bulletMovement = GetComponent <BulletMovement>(); }