Example #1
0
	public void updateDoor(int direction){
		for (int i = 0; i < itemBehaviourGameObject.transform.childCount; i++) {
			itemBehaviour = itemBehaviourGameObject.transform.GetChild (i).GetComponent<ItemBehaviour> ();		 
	
			if(direction==4)
			if(m_x == itemBehaviour.m_x+1 && m_y==itemBehaviour.m_y){
				if (String.Compare (itemBehaviour.name, "KEY_RECQUIRING_DOOR", false) == 0) {
					itemBehaviour.updateKeyRecquiringDoor(haveKey, enemieBehaviourGameObject);

				}

				if (String.Compare (itemBehaviour.name, "ALWAYS_OPEN_DOOR", false) == 0) {

						isFinish = itemBehaviour.isFinish; 
						to_board = itemBehaviour.to_board;
						to_spawner = itemBehaviour.to_spawner;
					 
				}
				
			}
			
			if(direction==2)		 
			if(m_x == itemBehaviour.m_x-1 && m_y==itemBehaviour.m_y){
			

				if (String.Compare (itemBehaviour.name, "KEY_RECQUIRING_DOOR", false) == 0) {
					itemBehaviour.updateKeyRecquiringDoor(haveKey, enemieBehaviourGameObject);
				}

				if (String.Compare (itemBehaviour.name, "ALWAYS_OPEN_DOOR", false) == 0) {
						isFinish = itemBehaviour.isFinish; 
						to_board = itemBehaviour.to_board;
						to_spawner = itemBehaviour.to_spawner;
					 
				}
			}
			if(direction==3)
			if(m_x == itemBehaviour.m_x && m_y==itemBehaviour.m_y+1){
		
			
				if (String.Compare (itemBehaviour.name, "KEY_RECQUIRING_DOOR", false) == 0) {
					itemBehaviour.updateKeyRecquiringDoor(haveKey, enemieBehaviourGameObject);
				}

				if (String.Compare (itemBehaviour.name, "ALWAYS_OPEN_DOOR", false) == 0) {
						isFinish = itemBehaviour.isFinish; 
						to_board = itemBehaviour.to_board;
						to_spawner = itemBehaviour.to_spawner;
					 
				}
				
			}
			if(direction==1)
			if(m_x == itemBehaviour.m_x && m_y==itemBehaviour.m_y-1){		 
		 
				if (String.Compare (itemBehaviour.name, "KEY_RECQUIRING_DOOR", false) == 0) {
					itemBehaviour.updateKeyRecquiringDoor(haveKey, enemieBehaviourGameObject);
					
				}
			 
				if (String.Compare (itemBehaviour.name, "ALWAYS_OPEN_DOOR", false) == 0) {

						to_board = itemBehaviour.to_board;
						to_spawner = itemBehaviour.to_spawner;
						isFinish = itemBehaviour.isFinish; 
					 						
				 
				}
				
			}
			
		}
	}