PlatformObject.init C# (CSharp) Method

init() public method

public init ( ) : void
return void
	public void init () {
		float travelDistance = (maximumHeight-minimumHeight);
		float lheight = parent.height.y;
		uMax = new Vector3(0,maximumHeight - parent.centerPoint.y,0);
		uMin = new Vector3(0,minimumHeight - parent.centerPoint.y,0);
		lMax = new Vector3(0,maximumHeight - parent.centerPoint.y - lheight,0);
		lMin = new Vector3(0,minimumHeight - parent.centerPoint.y - lheight,0);

		if (comesFromCeiling && comesFromFloor) {
			float midpoint = travelDistance/2f + (minimumHeight - parent.centerPoint.y);
			lheight = parent.height.y-(parent.height.y-midpoint);
			uMin = new Vector3(0,midpoint,0);
			lMax = new Vector3(0,midpoint - lheight,0);
			lMin = new Vector3(0,minimumHeight - parent.centerPoint.y - lheight,0);
		}
			

		if (initiallyExtended) {
			extending = false;
			if (upperPlatform != null) {upperPlatform.transform.localPosition = uMin;}
			if (lowerPlatform != null) {lowerPlatform.transform.localPosition = lMax;}
		} else {
			extending = true;
			if (upperPlatform != null) {upperPlatform.transform.localPosition = uMax;}
			if (lowerPlatform != null) {lowerPlatform.transform.localPosition = lMin;}
	
		}
		// if (platform.initiallyActive) {
		// 	platform.activate();
		// }
	}