示例#1
0
	public void interactWithParticularCharacter ( CharacterData characterToInteractWith, Main.HandleChoosenCharacter callBackOnChoosenCharacter, int actionType, IComponent iComponentOfObject )
	{
		if ( characterToInteractWith == null ) return;
				
		_currentActionType = actionType;
		_currentObjectIComponent = iComponentOfObject;
		characterToInteractWith.myCallBack = callBackOnChoosenCharacter;
			
		bool mayDoAction = false;
		int[] returnedClossestTile = ToolsJerry.findClossestEmptyTileAroundThisTileMining ( _currentObjectIComponent.position[0], _currentObjectIComponent.position[1], characterToInteractWith.position, characterToInteractWith.myID, MNLevelControl.getInstance ().gameElementsOnLevel[MNLevelControl.GRID_LAYER_NORMAL][characterToInteractWith.position[0]][characterToInteractWith.position[1]], 1 );
		if ( returnedClossestTile[0] != -1 ) 
		{
			if ( characterToInteractWith.characterValues[CharacterData.CHARACTER_ACTION_TYPE_POWER] > 0 )
			{
				if ( characterToInteractWith.characterValues[_currentActionType] > 0 )
				{
					if ( ! characterToInteractWith.blocked && ! characterToInteractWith.interactAction )
					{
						mayDoAction = true;
						chosenCharacterCallBack ( characterToInteractWith );
					}
				}
				else
				{
					if ( ! characterToInteractWith.blocked && ! characterToInteractWith.interactAction )
					{
						mayDoAction = true;
						chosenCharacterCallBack ( characterToInteractWith );
					}
				}
			}
		}
			
		if ( ! mayDoAction )
		{
			MessageCenter.getInstance ().createMarkInPosition ( _currentObjectIComponent.position );
			if ( characterToInteractWith.myCallBack != null ) characterToInteractWith.myCallBack ( null, true );
		}	
	}