Region.GetCenter C# (CSharp) Method

GetCenter() public method

Get the center of the region
public GetCenter ( float &x, float &z ) : void
x float /// A ///
z float /// A ///
return void
	public void GetCenter(out float x, out float z)
	{
		x = left+width*0.5f;
		z = bottom+height*0.5f;
	}
	

Same methods

Region::GetCenter ( Vector3 &pos ) : void
Region::GetCenter ( int &x, int &z ) : void

Usage Example

Example #1
0
	void OnOpenMenu() {		
		//Get the center of the megatile selection
		Region region = new Region(InputManager.use.resourceTileSelection.ToArray());
		Vector3 center = Vector3.zero;
		region.GetCenter(out center);
		
		//Open the menu
		OpenMenu(center,center);
	}