public void MoveToCell(Cell cell) { // check if new cell contains entity ICellEntity cellEntity = entityManager.GetEntity(cell); if (cellEntity != null) { if (cellEntity.ExecuteActionEntity(this)) { Moving = true; entityManager.MoveEntity(Cell, cell); this.Cell = cell; entityManager.MoveCellObject(gameObject, gameObject.transform.position, cell.getCenterPositionForEntity(), enemyMoveTime, this); } } else { // to call enemy's action if enemy moves into the player (otherwise it will only destroy player if he moves into the enemy if (cell == player.GetCurrentCell()) { this.ExecuteAction(); } Moving = true; entityManager.MoveEntity(Cell, cell); this.Cell = cell; entityManager.MoveCellObject(gameObject, gameObject.transform.position, cell.getCenterPositionForEntity(), enemyMoveTime, this); } }