// Async method for teleport private IEnumerator SetCharacterPositionAsync(CharacterScript character, Cell cell, SetCharacterPositionCallBack callback) { Entity entity = character.transform.GetComponent(typeof(Entity)) as Entity; IsoUnity.Cell destinyCell = SearchCellInMap(cell); var setCharacterPositionEvent = new GameEvent("teleport", new Dictionary <string, object>() { { "mover", entity.mover }, { "cell", destinyCell }, { "synchronous", true } }); Game.main.enqueueEvent(setCharacterPositionEvent); yield return(new WaitForEventFinished(setCharacterPositionEvent)); callback(true); }
/******************* ASYNC METHODS FOR EVENTS *******************/ // Teleport Character to Cell position public void SetCharacterPosition(CharacterScript character, Cell cell, SetCharacterPositionCallBack callback) { StartCoroutine(SetCharacterPositionAsync(character, cell, callback)); }