// When in prep state, call this function to change the state
	public void switchToState(ON_STAIR_AREA state_in, Globals.STAIR_FACING Stairfacing_in, 
	                          GameObject StairTrigger) {
		prepXcenter = StairTrigger.transform.position.x;
		Stairfacing = Stairfacing_in;
		onStairArea = state_in;

		curStair = StairTrigger.transform.parent.gameObject.GetComponent<StairController>();
		curStairSteps = curStair.StairSteps;
		if (!curStair) {
			Debug.LogError("STAIR: can't get parent stair controller");
		}
		// get the curStairSteps here
		// determin curNumOfSteps here
		if (state_in == ON_STAIR_AREA.PrepDown && onStairState == ON_STAIR_STATE.Not) {
			curNumOfSteps = curStairSteps;
		}
		else if (state_in == ON_STAIR_AREA.PrepUp && onStairState == ON_STAIR_STATE.Not) {
			curNumOfSteps = 0;
		}

	}
 // init with the stair steps
 void Start()
 {
     stairFacing = transform.GetComponentInParent <StairController> ().stairFacing == Globals.STAIR_FACING.Left ?
                   Globals.STAIR_FACING.Right : Globals.STAIR_FACING.Left;
 }
예제 #3
0
 // init with the stair steps
 void Start()
 {
     stairFacing = transform.GetComponentInParent <StairController> ().stairFacing;
 }